-
Notifications
You must be signed in to change notification settings - Fork 14
/
setup.py
43 lines (34 loc) · 1.47 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import os
import subprocess
from setuptools import setup, find_packages
with open('.version', 'r') as v_file:
version = v_file.read().replace('\n', '')
# Got this from here
# http://blogs.nopcode.org/brainstorm/2013/05/20/pragmatic-python-versioning-via-setuptools-and-git-tags/
# Fetch version from git tags, and write to version.py.
# Also, when git is not available (PyPi package), use stored version.py.
version_py = os.path.join(os.path.dirname(__file__), 'dlt/version.py')
try:
build = subprocess.check_output(['git', 'rev-parse', '--short', 'HEAD']).rstrip().decode("utf-8")
except:
with open(version_py, 'r') as fh:
build = open(version_py).read().strip().split('=')[-1].replace('"','')
full_version = version + '+' + build
version_msg = "# Do not edit this file, pipeline versioning is governed by git tags"
with open(version_py, 'w') as fh:
fh.write(version_msg + os.linesep + "__version__ = \'" + full_version + '\'')
readme = open('README.md').read()
setup(name='dlt',
version=full_version,
description='Deep Learning Toolbox for PyTorch',
long_description=readme,
url='https://github.com/dmarnerides/pydlt',
license='BSD',
author='Demetris Marnerides',
author_email='[email protected]',
packages=find_packages(exclude=['docs', 'tests']),
entry_points={
'console_scripts': ['dlt-plot=dlt.viz.csvplot:plot_csv',
'dlt-dispatch=dlt.util.dispatch:dispatch']
}
)