1
|
|
|
import os |
2
|
|
|
import sys |
3
|
|
|
import subprocess |
4
|
|
|
from collections import OrderedDict |
5
|
|
|
from setuptools import setup |
6
|
|
|
|
7
|
|
|
|
8
|
|
|
my_dir = os.path.dirname(os.path.realpath(__file__)) |
9
|
|
|
|
10
|
|
|
|
11
|
|
|
# Modify based on your project |
12
|
|
|
PROJECT_SLUG = 'so-magic' |
13
|
|
|
CHANGELOG_FILENAME = 'CHANGELOG.rst' |
14
|
|
|
source_code_repo = f'https://github.com/boromir674/{PROJECT_SLUG}' |
15
|
|
|
changelog = f'{source_code_repo}/blob/master/CHANGELOG.rst' |
16
|
|
|
|
17
|
|
|
|
18
|
|
|
def run(cmd): |
19
|
|
|
os.environ['PYTHONUNBUFFERED'] = "1" |
20
|
|
|
proc = subprocess.Popen(cmd, |
21
|
|
|
stdout=subprocess.PIPE, |
22
|
|
|
stderr=subprocess.STDOUT, |
23
|
|
|
) |
24
|
|
|
_stdout, _stderr = proc.communicate() |
25
|
|
|
|
26
|
|
|
return proc.returncode, _stdout, _stderr |
27
|
|
|
|
28
|
|
|
|
29
|
|
|
exit_code, stdout, stderr = run([sys.executable, os.path.join(my_dir, 'scripts', 'parse_package_version.py')]) |
30
|
|
|
if exit_code == 0: |
31
|
|
|
VERSION = stdout.decode('utf-8').replace('\n', '') |
32
|
|
|
print(f'Parsed version: {VERSION}') |
33
|
|
|
else: |
34
|
|
|
print(stdout) |
35
|
|
|
print('Failed to automatically parse the package version. Either set it manually in setup.py (or setup.cfg) or' |
36
|
|
|
'fix the automation.') |
37
|
|
|
sys.exit(1) |
38
|
|
|
|
39
|
|
|
setup( |
40
|
|
|
name=PROJECT_SLUG, |
41
|
|
|
version=VERSION, |
|
|
|
|
42
|
|
|
long_description_content_type='text/x-rst', |
43
|
|
|
author='Konstantinos Lampridis', |
44
|
|
|
author_email='[email protected]', |
45
|
|
|
classifiers=[ |
46
|
|
|
'Development Status :: 4 - Beta', |
47
|
|
|
'Intended Audience :: Developers', |
48
|
|
|
'Intended Audience :: Science/Research', |
49
|
|
|
'License :: OSI Approved :: GNU General Public License v3 (GPLv3)', |
50
|
|
|
'Natural Language :: English', |
51
|
|
|
'Operating System :: POSIX :: Linux', |
52
|
|
|
'Operating System :: MacOS', |
53
|
|
|
'Programming Language :: Python', |
54
|
|
|
'Programming Language :: Python :: 3.6', |
55
|
|
|
'Programming Language :: Python :: 3.7', |
56
|
|
|
'Programming Language :: Python :: 3.8', |
57
|
|
|
'Topic :: Scientific/Engineering :: Artificial Intelligence', |
58
|
|
|
'Topic :: Scientific/Engineering :: Information Analysis', |
59
|
|
|
'Topic :: Scientific/Engineering :: Visualization', |
60
|
|
|
'Topic :: Software Development :: Libraries :: Python Modules', |
61
|
|
|
], |
62
|
|
|
test_suite='tests', |
63
|
|
|
project_urls=OrderedDict([ |
64
|
|
|
('Issue Tracker', f'{source_code_repo}/issues'), |
65
|
|
|
('Changelog', changelog), |
66
|
|
|
('Source', source_code_repo), |
67
|
|
|
('Documentation', f'https://{PROJECT_SLUG}.readthedocs.io/'), |
68
|
|
|
]), |
69
|
|
|
download_url=f'https://github.com/boromir674/so-magic/archive/v{VERSION}.tar.gz', # help easy_install do its tricks |
70
|
|
|
) |
71
|
|
|
|