-
Notifications
You must be signed in to change notification settings - Fork 1
/
setup.py
executable file
·56 lines (47 loc) · 1.85 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
#!/usr/bin/env python
# pylint: disable=C
import os
import io
from setuptools import setup, find_packages
_dir = os.path.abspath(os.path.dirname(__file__))
SRC = os.path.join(_dir, 'fspath')
README = os.path.join(_dir, 'README.rst')
DOCS = os.path.join(_dir, 'docs')
TESTS = os.path.join(_dir, 'tests')
try:
# Python 2.7
from imp import load_source
except ImportError:
import importlib
def load_source(modname, modpath):
# https://docs.python.org/3/library/importlib.html#importing-a-source-file-directly
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
# import pkginfo without importing 'fspath/__init__.py' which imports
# third-party dependencies that need to be installed first (e.g. 'six').
PKG = load_source('__pkginfo__', os.path.join(SRC, '__pkginfo__.py'))
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()
setup(
name = PKG.package
, version = PKG.version
, description = PKG.description
, long_description = readFile(README)
, url = PKG.url
, author = PKG.authors[0]
, author_email = PKG.emails[0]
, license = PKG.license
, keywords = PKG.keywords
, packages = find_packages(exclude=['docs', 'tests'])
, install_requires = PKG.install_requires
, entry_points = PKG.get_entry_points()
# See https://pypi.python.org/pypi?%3Aaction=list_classifiers
, classifiers = PKG.classifiers
)