cic-internal-integration/apps/cic-notify/setup.py

53 lines
1.3 KiB
Python
Raw Normal View History

2021-02-07 03:29:24 +01:00
# standard imports
2021-04-16 22:24:07 +02:00
import logging
import subprocess
import time
2021-02-07 03:29:24 +01:00
from setuptools import setup
# local imports
2021-04-16 22:24:07 +02:00
from cic_notify.version import version_string
logg = logging.getLogger()
def git_hash():
git_hash = subprocess.run(['git', 'rev-parse', 'HEAD'], capture_output=True)
git_hash_brief = git_hash.stdout.decode('utf-8')[:8]
return git_hash_brief
try:
version_git = git_hash()
version_string += '+build.{}'.format(version_git)
except FileNotFoundError:
time_string_pair = str(time.time()).split('.')
version_string += '+build.{}{:<09d}'.format(
time_string_pair[0],
int(time_string_pair[1]),
)
logg.info(f'Final version string will be {version_string}')
2021-02-07 03:29:24 +01:00
requirements = []
requirements_file = open('requirements.txt', 'r')
while True:
requirement = requirements_file.readline()
if requirement == '':
break
requirements.append(requirement.rstrip())
requirements_file.close()
test_requirements = []
test_requirements_file = open('test_requirements.txt', 'r')
while True:
test_requirement = test_requirements_file.readline()
if test_requirement == '':
break
test_requirements.append(test_requirement.rstrip())
test_requirements_file.close()
setup(
2021-04-16 22:24:07 +02:00
version=version_string,
2021-02-07 03:29:24 +01:00
install_requires=requirements,
2021-04-16 22:24:07 +02:00
tests_require=test_requirements)