1
0
mirror of https://github.com/certbot/certbot.git synced 2025-08-06 16:42:41 +03:00
Files
certbot/letstest/scripts/version.py
Brad Warren 1bb09da270 Update and run isort (#9573)
I want to use isort as part of https://github.com/certbot/certbot/issues/9572 because I want to do it programmatically, however, I felt like the config needed to be tweaked a bit due to it not understanding what is and is not our own code.

This PR updates the isort config so it recognizes our own modules and runs `isort .` from the root of the repo to update everything.

* update isort config

* run "isort ."
2023-02-10 10:51:20 -08:00

32 lines
883 B
Python
Executable File

#!/usr/bin/env python
"""Get the current Certbot version number.
Provides a simple utility for determining the Certbot version number
"""
from __future__ import print_function
from os.path import abspath
from os.path import dirname
from os.path import join
import re
def certbot_version(letstest_scripts_dir):
"""Return the version number stamped in certbot/__init__.py."""
return re.search('''^__version__ = ['"](.+)['"].*''',
file_contents(join(dirname(dirname(letstest_scripts_dir)),
'certbot',
'certbot',
'__init__.py')),
re.M).group(1)
def file_contents(path):
with open(path) as file:
return file.read()
if __name__ == '__main__':
print(certbot_version(dirname(abspath(__file__))))