1
0
mirror of https://github.com/certbot/certbot.git synced 2026-01-26 07:41:33 +03:00
Files
certbot/letstest/scripts/version.py
Brad Warren dd0e590de3 Make a test farm tests package (#8821)
Fixes https://github.com/certbot/certbot/issues/8781.

This PR makes our test farm tests into a normal package so it and its dependencies can be tracked and installed like our other packages.

Other noteworthy changes in this PR:

* Rather than continuing to place logs in your CWD, they're placed in a temporary directory that is printed to the terminal.
*  `tests/letstest/auto_targets.yaml` was deleted rather than renamed because the file is no longer used.

* make a letstest package

* remove deleted deps

* fix letstest install

* add __init__.py

* call main

* Explicitly mention activating venv

* rerename file

* fix version.py path

* clarify "this"

* Use >= instead of caret requirement
2021-05-03 17:42:30 -07:00

29 lines
844 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(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__))))