Skip to content

Commit

Permalink
Added an experimental setup.py file for py2exe.
Browse files Browse the repository at this point in the history
Relates to issues #13 and #15.
  • Loading branch information
Aeva Palecek committed Jan 7, 2017
1 parent d1e4ff2 commit 011b8de
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# reference:
# - http://py2exe.org/index.cgi/Tutorial
# - https://gmigdos.wordpress.com/2014/06/29/how-to-bundle-python-gtk3-apps-on-windows-with-py2exe/

import os
import sys
import glob
import site
import shutil
from distutils.core import setup
import py2exe

dist_dir = os.path.join(os.getcwd(), 'dist')
if os.path.isdir(dist_dir):
shutil.rmtree(dist_dir)
os.makedirs(dist_dir)

gnome_path = os.path.join(site.getsitepackages()[1], "gnome")
gnome_resources = [
'etc',
'lib\\gtk-3.0', 'lib\\girepository-1.0', 'lib\\gio', 'lib\\gdk-pixbuf-2.0',
'share\\glib-2.0', 'share\\fonts', 'share\\icons', 'share\\themes\\Default',
'share\\themes\\HighContrast'
]
gnome_resources += glob.glob(os.path.join(gnome_path, "*.dll"))

def bundle(resource):
src_path = os.path.join(gnome_path, resource)
dest_path = os.path.join(dist_dir, resource)
assert os.path.exists(src_path)
if os.path.isdir(src_path):
shutil.copytree(src_path, dest_path)
else:
shutil.copy(src_path, dest_path)

map(bundle, gnome_resources)
sys.path.append(dist_dir)

# note, swap "console" and "windows" below to determine if a console
# window is to be shown
setup(console=['logger.py'], options={
'py2exe': {
'includes' : ['gi', 'PIL'],
'packages': ['gi', 'PIL']
}
})

0 comments on commit 011b8de

Please sign in to comment.