Merge pull request #143 from H4dr1en/patch-1

remove six and pathlib2 dependencies from setup.py
This commit is contained in:
Allegro AI 2020-06-05 17:21:49 +03:00 committed by GitHub
commit c8d1aa2966
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3,27 +3,31 @@ TRAINS - Artificial Intelligence Version Control
https://github.com/allegroai/trains https://github.com/allegroai/trains
""" """
import os.path
# Always prefer setuptools over distutils # Always prefer setuptools over distutils
from setuptools import setup, find_packages from setuptools import setup, find_packages
from six import exec_
from pathlib2 import Path
def read_text(filepath):
with open(filepath, "r") as f:
return f.read()
here = Path(__file__).resolve().parent here = os.path.dirname(__file__)
# Get the long description from the README file # Get the long description from the README file
long_description = (here / 'README.md').read_text() long_description = read_text(os.path.join(here, 'README.md'))
def read_version_string(): def read_version_string(version_file):
result = {} for line in read_text(version_file).splitlines():
exec_((here / 'trains/version.py').read_text(), result) if line.startswith('__version__'):
return result['__version__'] delim = '"' if '"' in line else "'"
return line.split(delim)[1]
else:
raise RuntimeError("Unable to find version string.")
version = read_version_string() version = read_version_string("trains/version.py")
requirements = (here / 'requirements.txt').read_text().splitlines() requirements = read_text(os.path.join(here, 'requirements.txt')).splitlines()
setup( setup(
name='trains', name='trains',