mirror of
https://github.com/certbot/certbot.git
synced 2026-06-05 06:42:10 -04:00
* Move version.py to tests/letstest since it's used by test_sdists.sh * Delete unused components of certbot-auto * Remove test_leauto_upgrades.sh and references to it * Remove test_letsencrypt_auto_certonly_standalone.sh and references to it * Remove outstanding references to certbot-auto * Remove references to letsencrypt-auto * find certbot in the correct directory * delete letsencrypt-auto-source line from .isort.cfg since that directory no longer contains any python code * remove (-auto) from certbot(-auto) * delete line from test * Improve style for version.py
28 lines
833 B
Python
Executable file
28 lines
833 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, dirname, join
|
|
import re
|
|
|
|
|
|
def certbot_version(caller_dir):
|
|
"""Return the version number stamped in certbot/__init__.py."""
|
|
return re.search('''^__version__ = ['"](.+)['"].*''',
|
|
file_contents(join(dirname(dirname(dirname(caller_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__))))
|