-
Notifications
You must be signed in to change notification settings - Fork 154
/
setup.py
122 lines (100 loc) · 3.38 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
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# furl - URL manipulation made simple.
#
# Ansgar Grunseid
# grunseid.com
# grunseid@gmail.com
#
# License: Build Amazing Things (Unlicense)
#
import os
import sys
from os.path import dirname, join as pjoin
from setuptools import setup, find_packages, Command
from setuptools.command.test import test as TestCommand
meta = {}
with open(pjoin('furl', '__version__.py')) as f:
exec(f.read(), meta)
readmePath = pjoin(dirname(__file__), 'README.md')
with open(readmePath) as f:
readmeContent = f.read()
class Publish(Command):
"""Publish to PyPI with twine."""
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
os.system('python setup.py sdist bdist_wheel')
sdist = 'dist/furl-%s.tar.gz' % meta['__version__']
wheel = 'dist/furl-%s-py2.py3-none-any.whl' % meta['__version__']
rc = os.system('twine upload "%s" "%s"' % (sdist, wheel))
sys.exit(rc)
class RunTests(TestCommand):
"""
Run the unit tests.
To test all supported Python versions (as specified in tox.ini) in
parallel, run
$ tox -p
By default, `python setup.py test` fails if tests/ isn't a Python
module; i.e. if the tests/ directory doesn't contain an __init__.py
file). But the tests/ directory shouldn't contain an __init__.py
file and tests/ shouldn't be a Python module. See
http://doc.pytest.org/en/latest/goodpractices.html
Running the unit tests manually here enables `python setup.py test`
without tests/ being a Python module.
"""
def run_tests(self):
from unittest import TestLoader, TextTestRunner
tests_dir = pjoin(dirname(__file__), 'tests/')
suite = TestLoader().discover(tests_dir)
result = TextTestRunner().run(suite)
sys.exit(0 if result.wasSuccessful() else -1)
setup(
name=meta['__title__'],
license=meta['__license__'],
version=meta['__version__'],
author=meta['__author__'],
author_email=meta['__contact__'],
url=meta['__url__'],
description=meta['__description__'],
long_description=readmeContent,
long_description_content_type='text/markdown',
packages=find_packages(),
include_package_data=True,
platforms=['any'],
classifiers=[
'License :: Public Domain',
'Natural Language :: English',
'Intended Audience :: Developers',
'Topic :: Software Development :: Libraries',
'Development Status :: 5 - Production/Stable',
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
'Programming Language :: Python :: 3.13',
'Programming Language :: Python :: Implementation :: PyPy',
'Programming Language :: Python :: Implementation :: CPython',
],
tests_require=[
'flake8',
'six>=1.8.0',
],
install_requires=[
'six>=1.8.0',
'orderedmultidict>=1.0.1',
],
cmdclass={
'test': RunTests,
'publish': Publish,
},
)