-
Notifications
You must be signed in to change notification settings - Fork 3
/
setup.py
137 lines (111 loc) · 3.49 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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
# -*- coding: utf-8 -*-
"""
"""
from setuptools import setup, find_packages
from setuptools.command.install import install
from setuptools.command.develop import develop
from glob import glob
from os.path import basename
from os.path import splitext
from pathlib import Path
import re
# #########################################################################
# These classes will only work if the user runs:
# python setup.py develop
# python setup.py install
class DevelopCommand(develop):
"""
Modify the `develop` installation workflow.
"""
def run(self):
# Pre-install: nothing
develop.run(self)
# Post-install: perhaps init the dirs and database?
class InstallCommand(install):
"""
Modify the starndard installation workflow.
"""
def run(self):
# Pre-install: nothing
install.run(self)
# Post-install: perhaps init the dirs and database?
# #########################################################################
def find_version(*file_paths):
"""
Find the package version for the given path.
Taken from https://github.com/pypa/pip/blob/master/setup.py and modified
to suit my needs/tastes.
"""
version_file = Path(__file__).parent.joinpath(*file_paths)
with open(str(version_file), 'r') as openf:
data = openf.read()
version_match = re.search(
r"^__version__ = ['\"]([^'\"]*)['\"]",
data,
re.M,
)
if version_match:
return version_match.group(1)
raise RuntimeError("Unable to find version string.")
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"Intended Audience :: Information Technology",
"Intended Audience :: System Administrators",
"License :: OSI Approved :: MIT License",
"Operating System :: POSIX :: Linux",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: Implementation :: CPython",
"Topic :: Internet :: WWW/HTTP :: WSGI :: Application",
"Topic :: Software Development :: Build Tools",
]
requires = [
"sqlalchemy>=1.2.7",
"flask>=1.0.2",
"lxml>=4.2.1",
"requests>=2.20.1",
]
entry_points = {
'console_scripts': [
'pynuget = pynuget.cli:main',
],
}
with open("README.rst", 'r') as openf:
long_description = openf.read()
setup(
# General
name="pynuget",
version=find_version('src', 'pynuget', '__init__.py'),
# Descriptions
description="A Python-based NuGet Server",
long_description=long_description,
long_description_content_type='text/x-rst',
# Owner
url='https://github.com/dougthor42/pynuget/',
author='Douglas Thor',
author_email='[email protected]',
# Files
package_dir={'': 'src'},
packages=find_packages(where='src'),
include_package_data=True,
# these get copied to sys.prefix/data, which will be the venv's folder.
data_files=[
('data', ['wsgi.py']),
('data', ['apache-example.conf']),
],
py_modules=[splitext(basename(path))[0] for path in glob('src/*.py')],
classifiers=classifiers,
keywords='nuget packaging c# csharp',
# Versions and Requirements
python_requires=">=3.6",
install_requires=requires,
#tests_requires=
entry_points=entry_points,
# https://stackoverflow.com/a/36902139/1354930
cmdclass={
'develop': DevelopCommand,
'install': InstallCommand,
},
)