-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added an experimental setup.py file for py2exe.
- Loading branch information
Aeva Palecek
committed
Jan 7, 2017
1 parent
d1e4ff2
commit 011b8de
Showing
1 changed file
with
46 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'] | ||
} | ||
}) |