2
2
# -*- coding: utf-8 -*-
3
3
from __future__ import print_function
4
4
5
- # Note: To use the 'upload' functionality of this file, you must:
6
- # $ pip install twine
7
-
5
+ import io
8
6
import os
7
+ import shutil
9
8
import sys
10
9
11
- from shutil import rmtree
12
- from codecs import open
13
- from setuptools import find_packages , setup , Command
10
+ from setuptools import setup , Command
11
+
12
+ from crossplane import (
13
+ __title__ , __summary__ , __url__ , __version__ , __author__ , __email__ ,
14
+ __package__ , __license__
15
+ )
16
+
14
17
15
- here = os .path .abspath (os .path .dirname (__file__ ))
16
- path = os .path .join (here , 'README.rst' )
17
- with open (path , encoding = 'utf-8' ) as f :
18
- readme = '\n ' + f .read ()
18
+ def get_readme ():
19
+ here = os .path .abspath (os .path .dirname (__file__ ))
20
+ path = os .path .join (here , 'README.rst' )
21
+ with io .open (path , encoding = 'utf-8' ) as f :
22
+ return '\n ' + f .read ()
19
23
20
24
21
25
class UploadCommand (Command ):
@@ -38,29 +42,29 @@ def finalize_options(self):
38
42
def run (self ):
39
43
try :
40
44
self .status ('Removing previous builds…' )
41
- rmtree (os .path .join (here , 'dist' ))
45
+ shutil . rmtree (os .path .join (here , 'dist' ))
42
46
except OSError :
43
47
pass
44
48
45
49
self .status ('Building Source and Wheel (universal) distribution…' )
46
50
os .system ('{0} setup.py sdist bdist_wheel --universal' .format (sys .executable ))
47
51
48
- self .status ('Uploading the package to PyPi via Twine…' )
52
+ self .status ('Uploading the package to PyPI via Twine…' )
49
53
os .system ('twine upload dist/*' )
50
54
51
55
sys .exit ()
52
56
53
57
54
58
setup (
55
- name = 'crossplane' ,
56
- version = '0.1.0' ,
57
- description = 'Reliable and fast NGINX configuration file parser.' ,
58
- long_description = readme ,
59
- author = 'Arie van Luttikhuizen' ,
60
-
61
- url = 'https://github.com/nginxinc/crossplane' ,
62
- packages = find_packages ( exclude = [ 'tests' ]) ,
63
- license = 'Apache 2.0' ,
59
+ name = __title__ ,
60
+ version = __version__ ,
61
+ description = __summary__ ,
62
+ long_description = get_readme () ,
63
+ author = __author__ ,
64
+ author_email = __email__ ,
65
+ url = __url__ ,
66
+ packages = [ __package__ ] ,
67
+ license = __license__ ,
64
68
classifiers = [
65
69
'Development Status :: 3 - Alpha' ,
66
70
'Intended Audience :: Developers' ,
@@ -83,7 +87,5 @@ def run(self):
83
87
'crossplane = crossplane.__main__:main'
84
88
],
85
89
},
86
- cmdclass = {
87
- 'upload' : UploadCommand # setup.py publish support
88
- }
90
+ cmdclass = {'upload' : UploadCommand }
89
91
)
0 commit comments