forked from tumblr/pytumblr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
137 lines (107 loc) · 3.56 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
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import io
import sys
from shutil import rmtree
from setuptools import setup, Command
readme_file = os.path.join(os.path.abspath(os.path.dirname(__file__)),
'README.rst')
with io.open(readme_file, encoding='utf-8') as f:
long_description = '\n' + f.read()
class TestUploadCommand(Command):
"""Allow testing setup.py upload to testpypi."""
description = 'Build and publish the package to the test pypi server.'
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
try:
import twine
except ImportError:
print('Twine is required for testing uploads')
sys.exit()
assert twine
try:
print('Removing previous builds…')
rmtree(os.path.join(
os.path.abspath(os.path.dirname(__file__)),
'dist'))
except OSError:
pass
print('Building Source and Wheel (universal) distribution…')
os.system('{0} setup.py sdist bdist_wheel --universal'.format(sys.executable))
print('Uploading the package to PyPi via Twine…')
os.system('twine upload --repository-url https://test.pypi.org/legacy/ dist/*')
sys.exit()
class UploadCommand(Command):
"""Allow uploading to pypi with setup.py"""
description = 'Build and publish the package to pypi.'
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
try:
import twine
except ImportError:
print('Twine is required for testing uploads')
sys.exit()
assert twine
try:
print('Removing previous builds…')
rmtree(os.path.join(
os.path.abspath(os.path.dirname(__file__)),
'dist'))
except OSError:
pass
print('Building Source and Wheel (universal) distribution…')
os.system('{0} setup.py sdist bdist_wheel --universal'.format(sys.executable))
print('Uploading the package to PyPi via Twine…')
os.system('twine upload dist/*')
sys.exit()
setup(
name="PyTumblr",
version="0.0.8",
description="A Python API v2 wrapper for Tumblr",
long_description=long_description,
author="Tumblr",
author_email="accounts@tumblr.com",
url="https://github.com/tumblr/pytumblr",
download_url="https://github.com/tumblr/pytumblr/archive/0.0.8.tar.gz",
packages=['pytumblr'],
license="Apache Software License 2.0",
zip_safe=False,
keywords='pytumblr',
classifiers=[
'Development Status :: 4 - Beta',
'Intended Audience :: Developers',
'License :: OSI Approved :: Apache Software License',
'Natural Language :: English',
"Programming Language :: Python :: 2",
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
],
test_suite='nose.collector',
install_requires=[
'future',
'requests-oauthlib',
],
tests_require=[
'nose',
'nose-cov',
'mock'
],
cmdclass={
'testupload': TestUploadCommand,
'upload': UploadCommand,
},
)