Skip to content

Commit 3fbbfd7

Browse files
committed
Omit py_modules in setup
This removes the py_modules keyword argument in the call to setup, and further shortens/simplifies setup.py by removing the now-unused build_py_modules function. The packages keyword argument already covers this, because we have no loose modules that are included in the distribution, and the call to find_packages: - Omits everything in test/ because it is directed to do so in the call. - Omits the gitdb/ directory (currently existing as a git submodule, not to be confused with Python submodules), because the ext/ directory that contains it does not itself directly contain an __init__.py file, so it is not a traditional package, yet ext/ is contained and found inside the directory git/ that *is* a traditional package, so the ext/ directory is not a namespace package either. - Includes all other modules, recursively, because they are all in a recursive traditional package structure under git/ that find_packages recognizes. To verify that this includes the same files in the built wheel and sdist distributions, I have listed the contents of the wheel with "unzip -l" and the sdist .tar.gz file with "tar tf" both before and after this change, verifying they list all the same entries.
1 parent e8c3085 commit 3fbbfd7

File tree

1 file changed

+0
-20
lines changed

1 file changed

+0
-20
lines changed

setup.py

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
from setuptools import setup, find_packages
55
from setuptools.command.build_py import build_py as _build_py
66
from setuptools.command.sdist import sdist as _sdist
7-
import fnmatch
87
import os
98
import sys
109

@@ -62,24 +61,6 @@ def _stamp_version(filename: str) -> None:
6261
print("WARNING: Couldn't find version line in file %s" % filename, file=sys.stderr)
6362

6463

65-
def build_py_modules(basedir: str, excludes: Sequence = ()) -> Sequence:
66-
# create list of py_modules from tree
67-
res = set()
68-
_prefix = os.path.basename(basedir)
69-
for root, _, files in os.walk(basedir):
70-
for f in files:
71-
_f, _ext = os.path.splitext(f)
72-
if _ext not in [".py"]:
73-
continue
74-
_f = os.path.join(root, _f)
75-
_f = os.path.relpath(_f, basedir)
76-
_f = "{}.{}".format(_prefix, _f.replace(os.sep, "."))
77-
if any(fnmatch.fnmatch(_f, x) for x in excludes):
78-
continue
79-
res.add(_f)
80-
return list(res)
81-
82-
8364
setup(
8465
name="GitPython",
8566
cmdclass={"build_py": build_py, "sdist": sdist},
@@ -91,7 +72,6 @@ def build_py_modules(basedir: str, excludes: Sequence = ()) -> Sequence:
9172
url="https://github.com/gitpython-developers/GitPython",
9273
packages=find_packages(exclude=["test", "test.*"]),
9374
include_package_data=True,
94-
py_modules=build_py_modules("./git", excludes=["git.ext.*"]),
9575
package_dir={"git": "git"},
9676
python_requires=">=3.7",
9777
install_requires=requirements,

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy