File tree 2 files changed +25
-1
lines changed
2 files changed +25
-1
lines changed Original file line number Diff line number Diff line change @@ -4,4 +4,4 @@ include CHANGELOG.md
4
4
include README.md
5
5
graft src/pkgmt/assets
6
6
global-exclude __pycache__
7
- global-exclude *.py[co]
7
+ global-exclude *.py[co]
Original file line number Diff line number Diff line change 2
2
import ast
3
3
from glob import glob
4
4
from os .path import basename , splitext
5
+ import fnmatch
5
6
6
7
from setuptools import find_packages
7
8
from setuptools import setup
9
+ from setuptools .command .build_py import build_py as build_py_orig
8
10
9
11
_version_re = re .compile (r"__version__\s+=\s+(.*)" )
10
12
49
51
]
50
52
51
53
54
+ exclude = ["*.conftest" ]
55
+
56
+
57
+ # this is the only way I found for excluding single .py files in wheels
58
+ # (https://stackoverflow.com/a/50592100/709975). MANIFEST.in only applies to source
59
+ # distributions. Some more info:
60
+ # https://github.com/pypa/packaging.python.org/issues/306
61
+ # https://github.com/pypa/setuptools/issues/511
62
+ class build_py (build_py_orig ):
63
+ def find_package_modules (self , package , package_dir ):
64
+ modules = super ().find_package_modules (package , package_dir )
65
+
66
+ return [
67
+ (pkg , mod , file )
68
+ for (pkg , mod , file ) in modules
69
+ if not any (
70
+ fnmatch .fnmatchcase (pkg + "." + mod , pat = pattern ) for pattern in exclude
71
+ )
72
+ ]
73
+
74
+
52
75
setup (
53
76
name = "ploomber-engine" ,
54
77
version = VERSION ,
58
81
author_email = None ,
59
82
url = None ,
60
83
packages = find_packages ("src" ),
84
+ cmdclass = {"build_py" : build_py },
61
85
package_dir = {"" : "src" },
62
86
py_modules = [splitext (basename (path ))[0 ] for path in glob ("src/*.py" )],
63
87
include_package_data = True ,
You can’t perform that action at this time.
0 commit comments