1
1
from __future__ import unicode_literals
2
2
3
3
import os
4
- import io
4
+ import sys
5
+ from shutil import rmtree
5
6
6
- from setuptools import setup
7
-
8
-
9
- def list_dir (dir ):
10
- result = [dir ]
11
- for file in os .listdir (dir ):
12
- if os .path .isdir (os .path .join (dir , file )):
13
- result .extend (list_dir (os .path .join (dir , file )))
14
- return result
15
-
16
-
17
- def read (* parts ):
18
- filename = os .path .join (os .path .abspath (os .path .dirname (__file__ )), * parts )
19
-
20
- with io .open (filename , encoding = 'utf-8' , mode = 'rt' ) as fp :
21
- return fp .read ()
7
+ from setuptools import setup , Command
22
8
23
9
24
10
NAME = "anti_header"
25
- PACKAGES = list_dir ('anti_header' )
26
11
DESCRIPTION = "fake chrome, firefox, opera browser header anti header"
27
- # LONG_DESCRIPTION = read('README.md')
28
- LONG_DESCRIPTION = ''
29
- URL = "https://github.com/ihandmine/anti-header.git"
12
+ URL = "https://github.com/ihandmine/anti-header"
30
13
AUTHOR = "handmine"
31
14
AUTHOR_EMAIL = "handmine@outlook.com"
32
- VERSION = "0.0.4 "
15
+ VERSION = "0.0.5 "
33
16
LICENSE = "MIT"
17
+ REQUIRES_PYTHON = ">=3.7.0"
18
+
19
+
20
+ here = os .path .abspath (os .path .dirname (__file__ ))
21
+ with open (f"{ here } /README.md" , encoding = 'utf-8' ) as f :
22
+ long_description = f .read ()
23
+
24
+
25
+ class UploadCommand (Command ):
26
+ """Support setup.py upload."""
27
+
28
+ description = "Build and publish the package."
29
+ user_options = []
30
+
31
+ @staticmethod
32
+ def status (s ):
33
+ """Prints things in bold."""
34
+ print ("\033 [1m{0}\033 [0m" .format (s ))
35
+
36
+ def initialize_options (self ):
37
+ pass
38
+
39
+ def finalize_options (self ):
40
+ pass
41
+
42
+ def run (self ):
43
+ try :
44
+ self .status ("Removing previous builds..." )
45
+ rmtree (os .path .join (here , "dist" ))
46
+ except OSError :
47
+ pass
48
+
49
+ self .status ("Building Source and Wheel distribution..." )
50
+ os .system ("{0} setup.py sdist bdist_wheel" .format (sys .executable ))
51
+
52
+ self .status ("Uploading the package to PyPI via Twine..." )
53
+ os .system ("twine upload dist/*" )
54
+
55
+ sys .exit ()
56
+
34
57
35
58
setup (
36
59
name = NAME ,
37
60
version = VERSION ,
38
61
description = DESCRIPTION ,
39
- long_description = LONG_DESCRIPTION ,
62
+ long_description = long_description ,
63
+ long_description_content_type = 'text/markdown' ,
40
64
classifiers = [
41
65
'License :: OSI Approved :: MIT License' ,
42
66
'Programming Language :: Python' ,
@@ -47,9 +71,11 @@ def read(*parts):
47
71
author = AUTHOR ,
48
72
author_email = AUTHOR_EMAIL ,
49
73
license = LICENSE ,
50
- packages = PACKAGES ,
74
+ packages = [NAME ],
75
+ package_dir = {NAME : NAME },
76
+ python_requires = REQUIRES_PYTHON ,
51
77
include_package_data = True ,
52
- zip_safe = True ,
78
+ zip_safe = False ,
53
79
install_requires = [
54
80
"anti-useragent" ,
55
81
],
@@ -58,4 +84,5 @@ def read(*parts):
58
84
'fake' , 'fake header' , 'browser' , 'spider header' ,
59
85
'anti' , 'anti header' , 'scrapy header'
60
86
],
87
+ cmdclass = {"upload" : UploadCommand },
61
88
)
0 commit comments