-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
118 lines (100 loc) · 3.39 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
#!/usr/bin/env python3
# encoding: utf-8
#
# Copyright (c) 2014, Peter Hillerström <peter.hillerstrom@gmail.com>
# All rights reserved. This software is licensed under the MIT license.
#
# For the full copyright and license information, please view the LICENSE
# file that was distributed with this source code.
import os
import re
import pprint
from pathlib import Path
from setuptools import setup, Command
# Solution to parse requirements by users Scrotch, Karsus and
# sh0rtcircuit: https://stackoverflow.com/a/57191701/470560
try: # pip >=20
from pip._internal.network.session import PipSession
from pip._internal.req import parse_requirements
except ImportError:
try: # 10 <= pip <= 19.3.1
from pip._internal.req import parse_requirements
from pip._internal.download import PipSession
except ImportError: # pip <= 9.0.3
from pip.req import parse_requirements
from pip.download import PipSession
def clean(require):
"""
Replace git requirements with just the requirement name
"""
cleaned = re.sub(r'^git\+[^#]+#egg=', '', require)
return str(cleaned)
def requires(filename):
path = Path(os.path.join(os.path.dirname(__file__), filename))
requires = [
clean(req.requirement)
for req
in parse_requirements(str(path), session=PipSession())
]
return requires
PACKAGE_NAME = 'ninhursag'
PACKAGE_VERSION = '0.10.0'
PACKAGES = ['app']
INSTALL_REQS = requires('requirements/stable.txt')
TEST_REQS = requires('requirements/dev.txt')
with open('README.md', 'r') as readme:
README_TEXT = readme.read()
class PyTest(Command):
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
import sys
import subprocess
opts = []
if '-v' in sys.argv:
opts.append('-v')
errno = subprocess.call([sys.executable, '-m', 'py.test', 'test'] + opts)
raise SystemExit(errno)
setup(
name=PACKAGE_NAME,
version=PACKAGE_VERSION,
packages=PACKAGES,
description="Ninhursag is visualisation of mineral reserves",
long_description=README_TEXT,
author='Peter Hillerström',
author_email='peter.hillerstrom@gmail.com',
license='MIT License',
url='https://github.com/peterhil/ninhursag',
requires=[],
install_requires=INSTALL_REQS,
tests_require=TEST_REQS,
entry_points={'app': '.test = test'},
scripts=[],
classifiers = [
'Development Status :: 4 - Beta',
'Environment :: Web Environment',
'Framework :: Flask',
'Intended Audience :: Education',
'Intended Audience :: End Users/Desktop',
'Intended Audience :: Science/Research',
'License :: OSI Approved :: MIT License',
'Natural Language :: English',
'Operating System :: MacOS :: MacOS X',
'Operating System :: POSIX',
'Operating System :: POSIX :: Linux',
'Programming Language :: JavaScript',
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Topic :: Education',
'Topic :: Scientific/Engineering :: Atmospheric Science',
'Topic :: Scientific/Engineering :: Information Analysis',
'Topic :: Scientific/Engineering :: Mathematics',
'Topic :: Scientific/Engineering :: Visualization',
],
cmdclass = {
'test': PyTest
},
)