-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
executable file
·76 lines (58 loc) · 2.24 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
#!/usr/bin/env python
"""
xxxx ``setup.py``
Metadata see ``xxxx/__pkginfo__.py``
"""
# pylint: disable=invalid-name
import os
import io
import importlib
from setuptools import setup, find_packages
_dir = os.path.abspath(os.path.dirname(__file__))
SRC = os.path.join(_dir, 'xxxx')
README = os.path.join(_dir, 'README.rst')
DOCS = os.path.join(_dir, 'docs')
TESTS = os.path.join(_dir, 'tests')
def load_source(modname, modpath):
spec = importlib.util.spec_from_file_location(modname, modpath)
if not spec:
raise ValueError("Error loading '%s' module" % modpath)
module = importlib.util.module_from_spec(spec)
if not spec.loader:
raise ValueError("Error loading '%s' module" % modpath)
spec.loader.exec_module(module)
return module
def readFile(fname, m='rt', enc='utf-8', nl=None):
with io.open(fname, mode=m, encoding=enc, newline=nl) as f:
return f.read()
PKG = load_source('__pkginfo__', os.path.join(SRC, '__pkginfo__.py'))
# https://packaging.python.org/guides/distributing-packages-using-setuptools/#configuring-your-project
setup(
name = PKG.package
, version = PKG.version
, description = PKG.description
, long_description = PKG.docstring
, url = PKG.url
, author = PKG.author
, author_email = PKG.author_email
, maintainer = PKG.maintainer
, maintainer_email = PKG.maintainer_email
, license = PKG.license
, classifiers = PKG.classifiers
, keywords = PKG.keywords
, project_urls = PKG.project_urls
, packages = PKG.packages
, py_modules = PKG.py_modules
, install_requires = PKG.install_requires
, python_requires = PKG.python_requires
, package_data = PKG.package_data
, data_files = PKG.data_files
, entry_points = PKG.get_entry_points()
, extras_require = {
# usage: pip install .\[develop,test\]
# - https://pip.pypa.io/en/stable/reference/pip_install/#examples
# - https://setuptools.readthedocs.io/en/latest/setuptools.html#declaring-extras-optional-features-with-their-own-dependencies
'develop' : PKG.develop_requires
, 'test' : PKG.test_requires
}
)