Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc7e0979

Browse files
setup.py: exclude all test files
by using exclude feature of find_packages.py_modules are determined by new function, whichrecursively scans the base dir but omits theexternal modules.Plus remove now obselete package_data settingSigned-off-by: Konrad Weihmann <kweihmann@outlook.com>
1 parent0374d7c commitc7e0979

File tree

1 file changed

+22
-3
lines changed

1 file changed

+22
-3
lines changed

‎setup.py

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
fromdistutils.command.build_pyimportbuild_pyas_build_py
1111
fromsetuptools.command.sdistimportsdistas_sdist
12+
importfnmatch
1213
importos
1314
importsys
1415
fromosimportpath
@@ -66,6 +67,24 @@ def _stamp_version(filename):
6667
print("WARNING: Couldn't find version line in file %s"%filename,file=sys.stderr)
6768

6869

70+
defbuild_py_modules(basedir,excludes=[]):
71+
# create list of py_modules from tree
72+
res=set()
73+
_prefix=os.path.basename(basedir)
74+
forroot,_,filesinos.walk(basedir):
75+
forfinfiles:
76+
_f,_ext=os.path.splitext(f)
77+
if_extnotin [".py"]:
78+
continue
79+
_f=os.path.join(root,_f)
80+
_f=os.path.relpath(_f,basedir)
81+
_f="{}.{}".format(_prefix,_f.replace(os.sep,"."))
82+
ifany(fnmatch.fnmatch(_f,x)forxinexcludes):
83+
continue
84+
res.add(_f)
85+
returnlist(res)
86+
87+
6988
setup(
7089
name="GitPython",
7190
cmdclass={'build_py':build_py,'sdist':sdist},
@@ -74,9 +93,9 @@ def _stamp_version(filename):
7493
author="Sebastian Thiel, Michael Trier",
7594
author_email="byronimo@gmail.com, mtrier@gmail.com",
7695
url="https://github.com/gitpython-developers/GitPython",
77-
packages=find_packages('.'),
78-
py_modules=['git.'+f[:-3]forfinos.listdir('./git')iff.endswith('.py')],
79-
package_data={'git.test': ['fixtures/*']},
96+
packages=find_packages(exclude=("test.*")),
97+
include_package_data=True,
98+
py_modules=build_py_modules("./git",excludes=["git.ext.*"]),
8099
package_dir={'git':'git'},
81100
python_requires='>=3.4',
82101
install_requires=requirements,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp