Skip to content

Commit

Permalink
Removed numpy tests from py2app to save 4M
Browse files Browse the repository at this point in the history
  • Loading branch information
Rob McMullen committed Nov 21, 2015
1 parent 772b748 commit 9beb01b
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
2 changes: 1 addition & 1 deletion omnimon/_omnimon_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version = "0.1.0"
version = "0.1.1"
26 changes: 26 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,28 @@ def remove_pyc(basedir):
if os.path.exists(path) and "numpy" not in path:
os.remove(path)

def remove_numpy_tests(basedir):
print basedir
for f in glob.glob("%s/*/tests" % basedir):
print f
shutil.rmtree(f)
for f in glob.glob("%s/tests" % basedir):
print f
shutil.rmtree(f)
for f in ["tests", "f2py", "testing", "core/include", "core/lib", "distutils"]:
path = os.path.join(basedir, f)
shutil.rmtree(path, ignore_errors=True)
testing = "%s/testing" % basedir
os.mkdir(testing)

tester_replace = """class Tester(object):
def bench(self, label='fast', verbose=1, extra_argv=None):
pass
test = bench
"""
fh = open("%s/__init__.py" % testing, "wb")
fh.write(tester_replace)
fh.close()

if 'nsis' not in sys.argv:
if sys.platform.startswith("win"):
Expand Down Expand Up @@ -352,6 +374,10 @@ def remove_pyc(basedir):
site_packages = "%s/Contents/Resources/lib/python2.7/site-packages.zip" % app_name
subprocess.call(['/usr/bin/zip', '-d', site_packages, "distutils/command/*", "wx/locale/*", "*.c", "*.pyx", "*.png", "*.jpg", "*.ico", "*.xcf", "*.icns", "reportlab/fonts/*", ])

# fixup numpy
numpy_dir = "%s/Contents/Resources/lib/python2.7/numpy" % app_name
remove_numpy_tests(numpy_dir)

fat_app_name = "%s/Omnimon.fat.app" % mac_dist_dir
os.rename(app_name, fat_app_name)
subprocess.call(['/usr/bin/ditto', '-arch', 'x86_64', fat_app_name, app_name])
Expand Down

0 comments on commit 9beb01b

Please sign in to comment.