]> git.phdru.name Git - ppu.git/blob - setup.py
Build(setup.py): Use `importlib` instead of deprecated `imp` for Python 3.4+
[ppu.git] / setup.py
1 #!/usr/bin/env python
2
3 from os.path import abspath, dirname, join
4 from setuptools import setup
5 import sys
6
7 if sys.version_info[:2] == (2, 7):
8     from imp import load_source
9
10 elif sys.version_info >= (3, 4):
11     from importlib.machinery import SourceFileLoader
12     import types
13
14     def load_source(fullname, path):
15         loader = SourceFileLoader(fullname, path)
16         loaded = types.ModuleType(loader.name)
17         loader.exec_module(loaded)
18         return loaded
19
20 else:
21     raise ImportError("ppu requires Python 2.7 or 3.4+")
22
23 versionpath = join(abspath(dirname(__file__)), "ppu", "__version__.py")
24 ppu_version = load_source("ppu_version", versionpath)
25
26 setup(
27     name='ppu',
28     version=ppu_version.__version__,
29     description='Broytman Portable Python Utilities',
30     long_description=open('README.rst', 'rU').read(),
31     long_description_content_type="text/x-rst",
32     author='Oleg Broytman',
33     author_email='phd@phdru.name',
34     url='https://phdru.name/Software/Python/ppu/',
35     project_urls={
36         'Homepage': 'https://phdru.name/Software/Python/ppu/',
37         'Documentation': 'https://phdru.name/Software/Python/ppu/docs/',
38         'Download': 'https://pypi.org/project/ppu/%s/'
39         % ppu_version.__version__,
40         'Git repo': 'https://git.phdru.name/ppu.git/',
41         'Github repo': 'https://github.com/phdru/ppu',
42         'Issue tracker': 'https://github.com/phdru/ppu/issues',
43     },
44     license='GPL',
45     platforms='Any',
46     classifiers=[
47         'Development Status :: 5 - Production/Stable',
48         'Environment :: Console',
49         'Intended Audience :: End Users/Desktop',
50         'License :: OSI Approved :: GNU General Public License (GPL)',
51         'Operating System :: OS Independent',
52         'Programming Language :: Python :: Implementation :: CPython',
53         'Programming Language :: Python :: Implementation :: PyPy',
54         'Programming Language :: Python :: 2',
55         'Programming Language :: Python :: 2.7',
56         'Programming Language :: Python :: 3',
57         'Programming Language :: Python :: 3.4',
58         'Programming Language :: Python :: 3.5',
59         'Programming Language :: Python :: 3.6',
60         'Programming Language :: Python :: 3.7',
61     ],
62     packages=['ppu'],
63     scripts=[
64         'scripts/cmp.py', 'scripts/remove-old-files.py', 'scripts/rm.py',
65         'scripts/which.py',
66     ],
67     python_requires='>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*',
68 )