This commit is contained in:
Marco Castelluccio 2018-12-13 23:41:34 +01:00
Родитель b81b5fe7cd
Коммит 6efa79fbea
1 изменённых файлов: 24 добавлений и 4 удалений

Просмотреть файл

@ -11,9 +11,28 @@ from setuptools import setup
here = os.path.dirname(__file__)
def load_requirements(filename):
with open(os.path.join(here, filename)) as f:
return f.read().strip().split('\n')
def read_requirements(file_):
requires = []
links = []
with open(os.path.join(here, file_)) as f:
for line in f.readlines():
line = line.strip()
if line.startswith('https://'):
links.append(line + '-1.0.0')
extras = ''
if '[' in line:
extras = '[' + line.split('[')[1].split(']')[0] + ']'
line = line.split('#')[1].split('egg=')[1] + extras
elif line == '' or line.startswith('#') or line.startswith('-'):
continue
line = line.split('#')[0].strip()
requires.append(line)
return sorted(list(set(requires))), links
install_requires, dependency_links = read_requirements('requirements.txt')
with open(os.path.join(here, 'VERSION')) as f:
@ -25,7 +44,8 @@ setup(
description='ML tools for Mozilla projects',
author='Marco Castelluccio',
author_email='mcastelluccio@mozilla.com',
install_requires=load_requirements('requirements.txt'),
install_requires=install_requires,
dependency_links=dependency_links,
packages=find_packages(exclude=['contrib', 'docs', 'tests']),
include_package_data=True,
license='MPL2',