scient 0.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
File without changes
scient-0.0.0/PKG-INFO ADDED
@@ -0,0 +1,9 @@
1
+ Metadata-Version: 2.1
2
+ Name: scient
3
+ Version: 0.0.0
4
+ Home-page:
5
+ Author:
6
+ Author-email:
7
+ License: Licence
8
+ Platform: any
9
+ Description-Content-Type: text/markdown
@@ -0,0 +1,9 @@
1
+ Metadata-Version: 2.1
2
+ Name: scient
3
+ Version: 0.0.0
4
+ Home-page:
5
+ Author:
6
+ Author-email:
7
+ License: Licence
8
+ Platform: any
9
+ Description-Content-Type: text/markdown
@@ -0,0 +1,6 @@
1
+ MANIFEST.in
2
+ setup.py
3
+ scient.egg-info/PKG-INFO
4
+ scient.egg-info/SOURCES.txt
5
+ scient.egg-info/dependency_links.txt
6
+ scient.egg-info/top_level.txt
@@ -0,0 +1 @@
1
+
scient-0.0.0/setup.cfg ADDED
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
scient-0.0.0/setup.py ADDED
@@ -0,0 +1,123 @@
1
+ # -*- coding: utf-8 -*-
2
+ """
3
+ Created on Tue Jan 3 20:36:58 2017
4
+
5
+ @author: a
6
+ """
7
+ package='scient'#包名,需与文件夹名一致
8
+ version='0.0.0'
9
+ #buildpy 需要编译为.c的.py文件,需明确列出文件名,否则打包wheel时无法定位ext_modules
10
+ #buildpy=['elect/test.py']
11
+ buildpy=[]
12
+ #include 需要复制tar.gz包中的资源文件或文件夹,必须是tar.gz中包含的资源
13
+ #include=['elect/data','elect/pkgs/jieba/analyse/idf.txt','elect/pkgs']
14
+ include=[]
15
+ #exclude 需要排除的文件或文件夹,
16
+ #exclude=['elect/apps','elect/guard.py','elect/data/brand.json','elect/pkgs']+[package+'/nltk/'+i for i in os.listdir(package+'/nltk') if i.endswith('.py') and i.startswith('__') and i not in ['__init__.py']]
17
+ exclude=[]
18
+ #include和exclude同时存在的内容,会exclude
19
+
20
+ #setup
21
+ keywords = ()
22
+ description = ""
23
+ long_description = ""#如果有README.md,该项会被README.md内容覆盖
24
+ url = ""
25
+ author = ""
26
+ author_email = ""
27
+ license = "Licence"
28
+ platforms = "any"
29
+ install_requires = []#'numpy>=1.14.0', 'pandas>=2.2.0', 'scipy>=1.0.0']
30
+ #%%以下内容不可修改
31
+ import os,io
32
+ import sys
33
+ from setuptools import setup
34
+
35
+ #路径分隔符统一
36
+ include=[i.replace('\\','/') for i in include]
37
+ exclude=[i.replace('\\','/') for i in exclude]
38
+ buildpy=[i.replace('\\','/') for i in buildpy]
39
+
40
+ #README.md
41
+ if os.path.exists('README.md'):
42
+ with io.open('README.md',encoding='utf-8') as f:
43
+ long_description = f.read()
44
+
45
+ #生成MANIFEST.in
46
+ with open('MANIFEST.in','w') as f:
47
+ for i in include:
48
+ if os.path.isdir(i):
49
+ f.write('recursive-include %s *\n'%i)
50
+ if os.path.isfile(i):
51
+ f.write('include %s\n'%i)
52
+ for i in exclude:
53
+ if os.path.isdir(i):
54
+ f.write('recursive-exclude %s *\n'%i)
55
+ if os.path.isfile(i):
56
+ f.write('exclude %s\n'%i)
57
+
58
+ ext_modules=[]
59
+ if sys.argv[1] in ('sdist'):
60
+ import re
61
+ from Cython.Build import cythonize
62
+
63
+ for i in buildpy:
64
+ #如果.c已存在,删除
65
+ if os.path.exists(i.replace('.py','.c')):
66
+ os.remove(i.replace('.py','.c'))
67
+ #将build_py编译为.c
68
+ ext_modules+=cythonize(i)
69
+ #clear comment
70
+ expr=re.compile(r'/\*.*?\*/',re.S)
71
+ for m in ext_modules:
72
+ for s in m.sources:
73
+ with open(s) as f:
74
+ text=f.read()
75
+ text=re.sub(expr,'',text)
76
+ with open(s,'w') as f:
77
+ f.write(text)
78
+ else:# sys.argv[1] in ('build','bdist','build_ext',None,'install','develop','bdist_egg','bdist_wheel','register','upload'):
79
+ from setuptools import Extension
80
+ for i in buildpy:
81
+ ext_modules.append(Extension(i.replace('.py','').replace('/','.'),sources=[i.replace('.py','.c')]))
82
+
83
+ #py_modules排除exclude文件夹、include文件夹
84
+ py_modules=[(dirpath,[i for i in dirnames if os.path.join(dirpath,i).replace('\\','/') not in exclude
85
+ and os.path.join(dirpath,i).replace('\\','/') not in include],filenames)
86
+ for dirpath, dirnames, filenames in os.walk(package) if dirpath.replace('\\','/') not in exclude
87
+ and dirpath.replace('\\','/') not in include]
88
+ #py_modules所有py文件
89
+ py_modules=sum([[os.path.join(dirpath,i).replace('\\','/') for i in filenames if i.endswith('.py')]
90
+ for dirpath, _, filenames in py_modules],[])
91
+ #py_modules排除exclude文件、include文件、buildpy文件
92
+ py_modules=[i for i in py_modules if i not in exclude+include+buildpy]
93
+
94
+ setup(
95
+ name = package,
96
+ version = version,
97
+ keywords = keywords,
98
+ description = description,
99
+ long_description = long_description,
100
+ long_description_content_type="text/markdown",
101
+ url = url,
102
+ author = author,
103
+ author_email = author_email,
104
+ license = license,
105
+ platforms = platforms,
106
+ install_requires = install_requires,
107
+ #打包范围
108
+ py_modules=[i.replace('.py','') for i in py_modules],
109
+ ext_modules=ext_modules,
110
+ #没有packages、include_package_data,不影响打包tar.gz,但是打包whl会缺少include
111
+ packages=[i.replace('/','.') for i in include if os.path.isdir(i)],
112
+ include_package_data = True,
113
+ )
114
+
115
+ #删除MANIFEST.in、.c、.egg-info
116
+ if sys.argv[1] in ('sdist'):
117
+ os.remove('MANIFEST.in')
118
+ for m in ext_modules:
119
+ for s in m.sources:
120
+ os.remove(s)
121
+ for i in os.listdir(package+'.egg-info'):
122
+ os.remove(package+'.egg-info/'+i)
123
+ os.rmdir(package+'.egg-info')