Skip to content

Commit 3ab3b29

Browse files
committed
include DLLS in packages correctly
1 parent aac4ff3 commit 3ab3b29

File tree

1 file changed

+25
-4
lines changed

1 file changed

+25
-4
lines changed

setup.py

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
include doc/*
2626
include pcbasic/data/USAGE.txt
2727
include pcbasic/data/*/*
28-
prune test
2928
"""
3029
#
3130
HERE = os.path.abspath(os.path.dirname(__file__))
@@ -73,24 +72,45 @@ def run(self):
7372
f.write(
7473
'include pcbasic/lib/README.md\n'
7574
'include pcbasic/compat/*.c\n'
75+
'prune test\n'
7676
)
7777
self.run_command('build_docs')
7878
sdist.sdist.run(self)
7979
os.remove(os.path.join(HERE, 'MANIFEST.in'))
8080

8181

82+
class SDistDevCommand(sdist.sdist):
83+
"""Custom sdist_dev command."""
84+
85+
def run(self):
86+
"""Run sdist_dev command."""
87+
with open(os.path.join(HERE, 'MANIFEST.in'), 'w') as f:
88+
f.write(DUNMANIFESTIN)
89+
f.write(
90+
'include pcbasic/lib/*\n'
91+
'include pcbasic/lib/*/*\n'
92+
'include pcbasic/compat/*.c\n'
93+
'recursive-include test *'
94+
)
95+
self.run_command('build_docs')
96+
sdist.sdist.run(self)
97+
os.remove(os.path.join(HERE, 'MANIFEST.in'))
98+
8299

83100
class BuildPyCommand(build_py.build_py):
84101
"""Custom build_py command."""
85102

86103
def run(self):
87-
""" Run sdist command. """
88-
print 'writing manifest'
104+
"""Run build_py command."""
89105
with open(os.path.join(HERE, 'MANIFEST.in'), 'w') as f:
90106
f.write(DUNMANIFESTIN)
107+
f.write('prune test\n')
91108
# include DLLs on Windows
92109
if sys.platform == 'win32':
93-
f.write('include pcbasic/lib/*.dll\n')
110+
if platform.architecture()[0] == '64bit':
111+
f.write('include pcbasic/lib/win32_x64/*.dll\n')
112+
else:
113+
f.write('include pcbasic/lib/win32_x86/*.dll\n')
94114
build_py.build_py.run(self)
95115
os.remove(os.path.join(HERE, 'MANIFEST.in'))
96116

@@ -186,6 +206,7 @@ def run(self):
186206
cmdclass={
187207
'build_docs': BuildDocCommand,
188208
'sdist': SDistCommand,
209+
'sdist_dev': SDistDevCommand,
189210
'build_py': BuildPyCommand,
190211
},
191212

0 commit comments

Comments
 (0)