Let py2exe packages the gtk dll and copy in dist_dir gtk configuration
This commit is contained in:
-12
@@ -8,18 +8,6 @@ try:
|
||||
except:
|
||||
pass
|
||||
|
||||
if os.name == 'nt' \
|
||||
and os.path.isdir(os.path.join(os.getcwd(), os.path.dirname(sys.argv[0]),
|
||||
'GTK')):
|
||||
sys.path.insert(0, os.path.join(os.getcwd(), os.path.dirname(sys.argv[0]),
|
||||
'GTK\\bin'))
|
||||
sys.path.insert(0, os.path.join(os.getcwd(), os.path.dirname(sys.argv[0]),
|
||||
'GTK\\lib'))
|
||||
os.environ['PATH'] = os.path.join(os.getcwd(), os.path.dirname(sys.argv[0]),
|
||||
'GTK\\bin') + ';' + os.environ['PATH']
|
||||
os.environ['PATH'] = os.path.join(os.getcwd(), os.path.dirname(sys.argv[0]),
|
||||
'GTK\\lib') + ';' + os.environ['PATH']
|
||||
|
||||
if os.name == 'mac' or \
|
||||
(hasattr(os, 'uname') and os.uname()[0] == 'Darwin'):
|
||||
resources = os.path.join(os.path.dirname(sys.argv[0]), '..', 'Resources')
|
||||
|
||||
@@ -5,9 +5,6 @@
|
||||
!ifndef VERSION
|
||||
!error "Missing VERSION! Specify it with '/DVERSION=<VERSION>'"
|
||||
!endif
|
||||
!ifndef GTKDIR
|
||||
!error "Missing GTKDIR! Specify it with '/DGTKDIR=<GTKDIR>'"
|
||||
!endif
|
||||
|
||||
;General
|
||||
Name "Tryton ${VERSION}"
|
||||
@@ -32,39 +29,9 @@ Section
|
||||
File "TODO"
|
||||
File "CHANGELOG"
|
||||
|
||||
SetOutPath "$PLUGINSDIR\GTK\bin"
|
||||
File /r "${GTKDIR}\bin\*"
|
||||
|
||||
SetOutPath "$PLUGINSDIR\GTK\etc"
|
||||
File /r "${GTKDIR}\etc\*"
|
||||
|
||||
SetOutPath "$PLUGINSDIR\GTK\lib"
|
||||
File /r "${GTKDIR}\lib\*"
|
||||
|
||||
SetOutPath "$PLUGINSDIR\GTK\share\gtk-2.0"
|
||||
File /r "${GTKDIR}\share\gtk-2.0\*"
|
||||
|
||||
SetOutPath "$PLUGINSDIR\GTK\share\gtkthemeselector"
|
||||
File /r "${GTKDIR}\share\gtkthemeselector\*"
|
||||
|
||||
SetOutPath "$PLUGINSDIR\GTK\share\locale\de"
|
||||
File /r "${GTKDIR}\share\locale\de\*"
|
||||
|
||||
SetOutPath "$PLUGINSDIR\GTK\share\locale\es"
|
||||
File /r "${GTKDIR}\share\locale\es\*"
|
||||
|
||||
SetOutPath "$PLUGINSDIR\GTK\share\locale\fr"
|
||||
File /r "${GTKDIR}\share\locale\fr\*"
|
||||
|
||||
SetOutPath "$PLUGINSDIR\GTK\share\themes"
|
||||
File /r "${GTKDIR}\share\themes\*"
|
||||
|
||||
SetOutPath "$PLUGINSDIR\doc"
|
||||
File /r "doc\*"
|
||||
|
||||
SetOutPath "$PLUGINSDIR\plugins"
|
||||
File /r "tryton\plugins\*"
|
||||
|
||||
;Run the exe
|
||||
SetOutPath '$EXEDIR'
|
||||
nsExec::Exec $PLUGINSDIR\tryton.exe
|
||||
|
||||
@@ -5,9 +5,6 @@
|
||||
!ifndef VERSION
|
||||
!error "Missing VERSION! Specify it with '/DVERSION=<VERSION>'"
|
||||
!endif
|
||||
!ifndef GTKDIR
|
||||
!error "Missing GTKDIR! Specify it with '/DGTKDIR=<GTKDIR>'"
|
||||
!endif
|
||||
|
||||
;Include Modern UI
|
||||
!include "MUI.nsh"
|
||||
@@ -98,39 +95,9 @@ SectionIn 1 2 RO
|
||||
File "TODO"
|
||||
File "CHANGELOG"
|
||||
|
||||
SetOutPath "$INSTDIR\GTK\bin"
|
||||
File /r "${GTKDIR}\bin\*"
|
||||
|
||||
SetOutPath "$INSTDIR\GTK\etc"
|
||||
File /r "${GTKDIR}\etc\*"
|
||||
|
||||
SetOutPath "$INSTDIR\GTK\lib"
|
||||
File /r "${GTKDIR}\lib\*"
|
||||
|
||||
SetOutPath "$INSTDIR\GTK\share\gtk-2.0"
|
||||
File /r "${GTKDIR}\share\gtk-2.0\*"
|
||||
|
||||
SetOutPath "$INSTDIR\GTK\share\gtkthemeselector"
|
||||
File /r "${GTKDIR}\share\gtkthemeselector\*"
|
||||
|
||||
SetOutPath "$INSTDIR\GTK\share\locale\de"
|
||||
File /r "${GTKDIR}\share\locale\de\*"
|
||||
|
||||
SetOutPath "$INSTDIR\GTK\share\locale\es"
|
||||
File /r "${GTKDIR}\share\locale\es\*"
|
||||
|
||||
SetOutPath "$INSTDIR\GTK\share\locale\fr"
|
||||
File /r "${GTKDIR}\share\locale\fr\*"
|
||||
|
||||
SetOutPath "$INSTDIR\GTK\share\themes"
|
||||
File /r "${GTKDIR}\share\themes\*"
|
||||
|
||||
SetOutPath "$INSTDIR\doc"
|
||||
File /r "doc\*"
|
||||
|
||||
SetOutPath "$INSTDIR\plugins"
|
||||
File /r "tryton\plugins\*"
|
||||
|
||||
;Write the installation path into the registry
|
||||
WriteRegStr HKCU "Software\tryton-${VERSION}" "" $INSTDIR
|
||||
WriteRegStr HKLM "Software\tryton-${VERSION}" "" $INSTDIR
|
||||
|
||||
@@ -49,31 +49,9 @@ if os.name == 'nt':
|
||||
'encodings',
|
||||
'gtk',
|
||||
'pytz',
|
||||
],
|
||||
'includes': 'pango,atk,gobject,cairo,pangocairo',
|
||||
'dll_excludes': [
|
||||
'iconv.dll',
|
||||
'intl.dll',
|
||||
'libatk-1.0-0.dll',
|
||||
'libgdk_pixbuf-2.0-0.dll',
|
||||
'libgdk-win32-2.0-0.dll',
|
||||
'libglib-2.0-0.dll',
|
||||
'libgmodule-2.0-0.dll',
|
||||
'libgobject-2.0-0.dll',
|
||||
'libgthread-2.0-0.dll',
|
||||
'libgtk-win32-2.0-0.dll',
|
||||
'libpango-1.0-0.dll',
|
||||
'libpangowin32-1.0-0.dll',
|
||||
'libcairo-2.dll',
|
||||
'libfontconfig-1.dll',
|
||||
'libfreetype-6.dll',
|
||||
'libgdkglext-win32-1.0.0.dll',
|
||||
'libglade-2.0-0.dll',
|
||||
'libgtkglext-win32-1.0-0.dll',
|
||||
'libpangocairo-1.0-0.dll',
|
||||
'libpangoft2-1.0-0.dll',
|
||||
'libxml2.dll',
|
||||
'zlib1.dll',
|
||||
'atk',
|
||||
'pango',
|
||||
'pangocairo',
|
||||
],
|
||||
}
|
||||
}
|
||||
@@ -101,7 +79,7 @@ elif os.name == 'mac' \
|
||||
|
||||
execfile(os.path.join('tryton', 'version.py'))
|
||||
|
||||
setup(name=PACKAGE,
|
||||
dist = setup(name=PACKAGE,
|
||||
version=VERSION,
|
||||
description='Tryton client',
|
||||
author='B2CK',
|
||||
@@ -144,3 +122,45 @@ setup(name=PACKAGE,
|
||||
},
|
||||
**args
|
||||
)
|
||||
|
||||
if os.name == 'nt':
|
||||
def find_gtk_dir():
|
||||
for directory in os.environ['PATH'].split(';'):
|
||||
if not os.path.isdir(directory):
|
||||
continue
|
||||
for file in ('gtk-demo.exe',):
|
||||
if os.path.isfile(os.path.join(directory, file)):
|
||||
return os.path.dirname(directory)
|
||||
return None
|
||||
|
||||
if 'py2exe' in dist.commands:
|
||||
import shutil
|
||||
gtk_dir = find_gtk_dir()
|
||||
|
||||
dist_dir = dist.command_obj['py2exe'].dist_dir
|
||||
|
||||
if os.path.isdir(os.path.join(dist_dir, 'plugins')):
|
||||
shutil.rmtree(os.path.join(dist_dir, 'plugins'))
|
||||
shutil.copytree(os.path.join(os.path.dirname(__file__), 'tryton', 'plugins'),
|
||||
os.path.join(dist_dir, 'plugins'))
|
||||
|
||||
if os.path.isdir(os.path.join(dist_dir, 'etc')):
|
||||
shutil.rmtree(os.path.join(dist_dir, 'etc'))
|
||||
shutil.copytree(os.path.join(gtk_dir, 'etc'),
|
||||
os.path.join(dist_dir, 'etc'))
|
||||
|
||||
if os.path.isdir(os.path.join(dist_dir, 'lib')):
|
||||
shutil.rmtree(os.path.join(dist_dir, 'lib'))
|
||||
shutil.copytree(os.path.join(gtk_dir, 'lib'),
|
||||
os.path.join(dist_dir, 'lib'))
|
||||
|
||||
for lang in ('de', 'es', 'fr'):
|
||||
if os.path.isdir(os.path.join(dist_dir, 'share', 'locale', lang)):
|
||||
shutil.rmtree(os.path.join(dist_dir, 'share', 'locale', lang))
|
||||
shutil.copytree(os.path.join(gtk_dir, 'share', 'locale', lang),
|
||||
os.path.join(dist_dir, 'share', 'locale', lang))
|
||||
|
||||
if os.path.isdir(os.path.join(dist_dir, 'share', 'themes', 'MS-Windows')):
|
||||
shutil.rmtree(os.path.join(dist_dir, 'share', 'themes', 'MS-Windows'))
|
||||
shutil.copytree(os.path.join(gtk_dir, 'share', 'themes', 'MS-Windows'),
|
||||
os.path.join(dist_dir, 'share', 'themes', 'MS-Windows'))
|
||||
|
||||
Reference in New Issue
Block a user