Replace py2exe and py2app by cx_Freeze

issue5084
issue5085
review28821002
This commit is contained in:
Cédric Krier committed 2016-10-02 14:58:47 +02:00
1 parent 3aadca7bf0
commit 8d89c49591
15 files changed
+271 -349

No files matched your search

+3 -1
View File
@@ -8,7 +8,9 @@ include setup-single.nsi
include setup-bundle.sh
include tryton.desktop
include *.nsh
include Microsoft.VC90.CRT.manifest
include setup-freeze.py
include make-*-installer.sh
include */gtk-2.0/*
include doc/*
recursive-include doc *.rst
recursive-include doc *.po
-43
View File
@@ -1,43 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity
version="5.0.0.0"
processorArchitecture="x86"
name="Tryton"
type="win32"
/>
<description>Tryton client</description>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel
level="asInvoker"
uiAccess="false">
</requestedExecutionLevel>
</requestedPrivileges>
</security>
</trustInfo>
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.VC90.CRT"
version="9.0.21022.8"
processorArchitecture="x86"
publicKeyToken="1fc8b3b9a1e18e3b">
</assemblyIdentity>
</dependentAssembly>
</dependency>
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="X86"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
</dependentAssembly>
</dependency>
</assembly>
+9 -21
View File
@@ -9,33 +9,21 @@ try:
except NameError:
pass
# True only if running as a py2exe app
if os.name == 'nt' and hasattr(sys, "frozen"):
if hasattr(sys, 'frozen'):
if not ('-v' in sys.argv or '--verbose' in sys.argv or
'-l' in sys.argv or '--log-level' in sys.argv):
sys.stdout = open(os.devnull, 'w')
sys.stderr = open(os.devnull, 'w')
etc = os.path.join(os.path.dirname(sys.executable), 'etc')
prefix = os.path.dirname(sys.executable)
os.environ['GTK_EXE_PREFIX'] = prefix
os.environ['GTK_DATA_PREFIX'] = prefix
etc = os.path.join(prefix, 'etc')
os.environ['GTK2_RC_FILES'] = os.path.join(etc, 'gtk-2.0', 'gtkrc')
os.environ['GDK_PIXBUF_MODULE_FILE'] = os.path.join(etc, 'gtk-2.0',
'gdk-pixbuf.loaders')
os.environ['GTK_IM_MODULE_FILE'] = os.path.join(etc, 'gtk-2.0',
'gtk.immodules')
os.environ['GDK_PIXBUF_MODULE_FILE'] = os.path.join(
etc, 'gtk-2.0', 'gdk-pixbuf.loaders')
os.environ['GTK_IM_MODULE_FILE'] = os.path.join(
etc, 'gtk-2.0', 'gtk.immodules')
if os.name == 'mac' or \
(hasattr(os, 'uname') and os.uname()[0] == 'Darwin'):
resources = os.path.join(os.path.dirname(sys.argv[0]), '..', 'Resources')
gtkrc = os.path.join(resources, 'gtkrc')
pixbuf_loader = os.path.join(resources, 'gdk-pixbuf.loaders')
pangorc = os.path.join(resources, 'pangorc')
immodules = os.path.join(resources, 'gtk.immodules')
if os.path.isdir(resources):
os.environ['GTK2_RC_FILES'] = gtkrc
os.environ['GTK_EXE_PREFIX'] = resources
os.environ['GTK_DATA_PREFIX'] = resources
os.environ['GDK_PIXBUF_MODULE_FILE'] = pixbuf_loader
os.environ['PANGO_RC_FILE'] = pangorc
os.environ['GTK_IM_MODULE_FILE'] = immodules
# Disable dbusmenu to show second menu in tabs
os.environ['UBUNTU_MENUPROXY'] = '0'
+107
View File
@@ -0,0 +1,107 @@
# GdkPixbuf Image Loader Modules file
# Automatically generated file, do not edit
# Created by gdk-pixbuf-query-loaders from gdk-pixbuf-2.34.0
#
# LoaderDir = @executable_path/lib/gdk-pixbuf-2.0/2.10.0/loaders
#
"@executable_path/lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-ani.so"
"ani" 4 "gdk-pixbuf" "Windows animated cursor" "LGPL"
"application/x-navi-animation" ""
"ani" ""
"RIFF ACON" " xxxx " 100
"@executable_path/lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-bmp.so"
"bmp" 5 "gdk-pixbuf" "BMP" "LGPL"
"image/bmp" "image/x-bmp" "image/x-MS-bmp" ""
"bmp" ""
"BM" "" 100
"@executable_path/lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-gif.so"
"gif" 4 "gdk-pixbuf" "GIF" "LGPL"
"image/gif" ""
"gif" ""
"GIF8" "" 100
"@executable_path/lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-icns.so"
"icns" 4 "gdk-pixbuf" "MacOS X icon" "GPL"
"image/x-icns" ""
"icns" ""
"icns" "" 100
"@executable_path/lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-ico.so"
"ico" 5 "gdk-pixbuf" "Windows icon" "LGPL"
"image/x-icon" "image/x-ico" "image/x-win-bitmap" "image/vnd.microsoft.icon" "application/ico" "image/ico" "image/icon" "text/ico" ""
"ico" "cur" ""
" \001 " "zz znz" 100
" \002 " "zz znz" 100
"@executable_path/lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-jpeg.so"
"jpeg" 5 "gdk-pixbuf" "JPEG" "LGPL"
"image/jpeg" ""
"jpeg" "jpe" "jpg" ""
"\377\330" "" 100
"@executable_path/lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-png.so"
"png" 5 "gdk-pixbuf" "PNG" "LGPL"
"image/png" ""
"png" ""
"\211PNG\r\n\032\n" "" 100
"@executable_path/lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-pnm.so"
"pnm" 4 "gdk-pixbuf" "PNM/PBM/PGM/PPM" "LGPL"
"image/x-portable-anymap" "image/x-portable-bitmap" "image/x-portable-graymap" "image/x-portable-pixmap" ""
"pnm" "pbm" "pgm" "ppm" ""
"P1" "" 100
"P2" "" 100
"P3" "" 100
"P4" "" 100
"P5" "" 100
"P6" "" 100
"@executable_path/lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-qtif.so"
"qtif" 4 "gdk-pixbuf" "QuickTime" "LGPL"
"image/x-quicktime" "image/qtif" ""
"qtif" "qif" ""
"abcdidsc" "xxxx " 100
"abcdidat" "xxxx " 100
"@executable_path/lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-svg.so"
"svg" 6 "gdk-pixbuf" "Scalable Vector Graphics" "LGPL"
"image/svg+xml" "image/svg" "image/svg-xml" "image/vnd.adobe.svg+xml" "text/xml-svg" "image/svg+xml-compressed" ""
"svg" "svgz" "svg.gz" ""
" <svg" "* " 100
" <!DOCTYPE svg" "* " 100
"@executable_path/lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-tga.so"
"tga" 4 "gdk-pixbuf" "Targa" "LGPL"
"image/x-tga" ""
"tga" "targa" ""
" \001\001" "x " 100
" \001\t" "x " 100
" \002" "xz " 99
" \003" "xz " 100
" \n" "xz " 100
" \v" "xz " 100
"@executable_path/lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-tiff.so"
"tiff" 5 "gdk-pixbuf" "TIFF" "LGPL"
"image/tiff" ""
"tiff" "tif" ""
"MM *" " z " 100
"II* " " z" 100
"II* \020 CR\002 " " z zzz z" 0
"@executable_path/lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-xbm.so"
"xbm" 4 "gdk-pixbuf" "XBM" "LGPL"
"image/x-xbitmap" ""
"xbm" ""
"#define " "" 100
"/*" "" 50
"@executable_path/lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-xpm.so"
"xpm" 4 "gdk-pixbuf" "XPM" "LGPL"
"image/x-xpixmap" ""
"xpm" ""
"/* XPM */" "" 100
+40
View File
@@ -0,0 +1,40 @@
# GTK+ Input Method Modules file
# Automatically generated file, do not edit
# Created by gtk-query-immodules-2.0 from gtk+-2.24.30
#
# ModulesPath = /Users/ced/.gtk-2.0/2.10.0/x86_64-apple-darwin15.5.0/immodules:/Users/ced/.gtk-2.0/2.10.0/immodules:/Users/ced/.gtk-2.0/x86_64-apple-darwin15.5.0/immodules:/Users/ced/.gtk-2.0/immodules:@executable_path/lib/gtk-2.0/2.10.0/x86_64-apple-darwin15.5.0/immodules:/Users/ced/gtk/inst/lib/gtk-2.0/2.10.0/immodules:/Users/ced/gtk/inst/lib/gtk-2.0/x86_64-apple-darwin15.5.0/immodules:/Users/ced/gtk/inst/lib/gtk-2.0/immodules
#
"@executable_path/lib/gtk-2.0/2.10.0/immodules/im-am-et.so"
"am_et" "Amharic (EZ+)" "gtk20" "@executable_path/share/locale" "am"
"@executable_path/lib/gtk-2.0/2.10.0/immodules/im-cedilla.so"
"cedilla" "Cedilla" "gtk20" "@executable_path/share/locale" "az:ca:co:fr:gv:oc:pt:sq:tr:wa"
"@executable_path/lib/gtk-2.0/2.10.0/immodules/im-cyrillic-translit.so"
"cyrillic_translit" "Cyrillic (Transliterated)" "gtk20" "@executable_path/share/locale" ""
"@executable_path/lib/gtk-2.0/2.10.0/immodules/im-inuktitut.so"
"inuktitut" "Inuktitut (Transliterated)" "gtk20" "@executable_path/share/locale" "iu"
"@executable_path/lib/gtk-2.0/2.10.0/immodules/im-ipa.so"
"ipa" "IPA" "gtk20" "@executable_path/share/locale" ""
"@executable_path/lib/gtk-2.0/2.10.0/immodules/im-multipress.so"
"multipress" "Multipress" "gtk20" "" ""
"@executable_path/lib/gtk-2.0/2.10.0/immodules/im-quartz.so"
"quartz" "Mac OS X Quartz" "gtk20" "@executable_path/share/locale" "ja:ko:zh:*"
"@executable_path/lib/gtk-2.0/2.10.0/immodules/im-thai.so"
"thai" "Thai-Lao" "gtk20" "@executable_path/share/locale" "lo:th"
"@executable_path/lib/gtk-2.0/2.10.0/immodules/im-ti-er.so"
"ti_er" "Tigrigna-Eritrean (EZ+)" "gtk20" "@executable_path/share/locale" "ti"
"@executable_path/lib/gtk-2.0/2.10.0/immodules/im-ti-et.so"
"ti_et" "Tigrigna-Ethiopian (EZ+)" "gtk20" "@executable_path/share/locale" "ti"
"@executable_path/lib/gtk-2.0/2.10.0/immodules/im-viqr.so"
"viqr" "Vietnamese (VIQR)" "gtk20" "@executable_path/share/locale" "vi"
+2
View File
@@ -0,0 +1,2 @@
include "../../share/themes/Clearlooks/gtk-2.0/gtkrc"
include "../../share/themes/Mac/gtk-2.0-key/gtkrc"
+14
View File
@@ -0,0 +1,14 @@
#!/bin/sh
version=`python setup.py --version`
python setup-freeze.py bdist_mac
rm -rf dist
mkdir dist
mv build/Tryton.app dist/
for f in CHANGELOG COPYRIGHT LICENSE README; do
cp ${f} dist/${f}.txt
done
cp -r doc dist/
rm -f "tryton-${version}.dmg"
hdiutil create "tryton-${version}.dmg" -volname "Tryton Client ${version}" \
-fs HFS+ -srcfolder dist
+6
View File
@@ -0,0 +1,6 @@
#!/bin/sh
version=`python setup.py --version`
python setup-freeze.py install_exe -d dist
makensis -DVERSION=${version} setup.nsi
makensis -DVERSION=${version} setup-single.nsi
+70
View File
@@ -0,0 +1,70 @@
import os
import sys
from subprocess import Popen, PIPE
from cx_Freeze import setup, Executable
include_files = [
('tryton/data', 'data'),
('tryton/plugins', 'plugins'),
(os.path.join(sys.prefix, 'lib/gtk-2.0'), 'lib/gtk-2.0'),
(os.path.join(sys.prefix, 'lib/gdk-pixbuf-2.0'), 'lib/gdk-pixbuf-2.0'),
(os.path.join(sys.prefix, 'share/locale'), 'share/locale'),
('%s/gtk-2.0/gtkrc' % sys.platform, 'etc/gtk-2.0/gtkrc'),
('%s/gtk-2.0/gtk.immodules' % sys.platform, 'etc/gtk-2.0/gtk.immodules'),
('%s/gtk-2.0/gdk-pixbuf.loaders' % sys.platform,
'etc/gtk-2.0/gdk-pixbuf.loaders'),
]
if sys.platform == 'win32':
include_files.extend([
(os.path.join(sys.prefix, 'share/themes/MS-Windows'),
'share/themes/MS-Windows'),
])
dll_paths = os.getenv('PATH', os.defpath).split(os.pathsep)
required_dlls = [
'librsvg-2-2.dll',
'libcroco-0.6-3.dll',
]
for dll in required_dlls:
for path in dll_paths:
path = os.path.join(path, dll)
if os.path.isfile(path):
break
else:
raise Exception('%s not found' % dll)
include_files.append((path, dll))
elif sys.platform == 'darwin':
include_files.extend([
(os.path.join(sys.prefix, 'share/themes/Clearlooks'),
'share/themes/Clearlooks'),
(os.path.join(sys.prefix, 'share/themes/Mac'),
'share/themes/Mac'),
])
version = Popen(
'python setup.py --version', stdout=PIPE, shell=True).stdout.read()
version = version.strip()
setup(name='tryton',
version=version,
options={
'build_exe': {
'compressed': False,
'include_files': include_files,
'silent': True,
'packages': ['gtk'],
'icon': os.path.join(
'tryton', 'data', 'pixmaps', 'tryton', 'tryton.ico'),
'include_msvcr': True,
},
'bdist_mac': {
'iconfile': os.path.join(
'tryton', 'data', 'pixmaps', 'tryton', 'tryton.icns'),
'bundle_name': 'Tryton',
}
},
executables=[Executable(
'bin/tryton',
base='Win32GUI' if sys.platform == 'win32' else None)])
-277
View File
@@ -4,8 +4,6 @@
from setuptools import setup, find_packages
import os
import glob
import sys
import re
@@ -42,61 +40,6 @@ package_data = {
}
data_files = []
if os.name == 'nt':
import py2exe
args['windows'] = [{
'script': os.path.join('bin', 'tryton'),
'icon_resources': [
(1, os.path.join('tryton', 'data', 'pixmaps',
'tryton', 'tryton.ico'))],
}]
args['options'] = {
'py2exe': {
'optimize': 0,
'bundle_files': 3, # don't bundle because gtk doesn't support it
'packages': [
'encodings',
'gtk',
'atk',
'pango',
'pangocairo',
'gio',
],
'dll_excludes': ['dnsapi.dll', 'usp10.dll', 'iphlpapi.dll'],
'excludes': ['Tkconstants', 'Tkinter', 'tcl'],
}
}
args['zipfile'] = 'library.zip'
data_files.append(('', ['msvcr90.dll', 'msvcp90.dll', 'msvcm90.dll']))
manifest = read('Microsoft.VC90.CRT.manifest')
args['windows'][0]['other_resources'] = [(24, 1, manifest)]
elif sys.platform == 'darwin':
import py2app
from modulegraph.find_modules import PY_SUFFIXES
PY_SUFFIXES.append('')
args['app'] = [os.path.join('bin', 'tryton')]
args['options'] = {
'py2app': {
'argv_emulation': True,
'includes': ('pygtk, gtk, glib, cairo, pango, pangocairo, atk, '
'gobject, gio, gtk.keysyms'),
'resources': 'tryton/plugins, tryton/data',
'frameworks':
'librsvg-2.2.dylib, libjpeg.9.dylib, libtiff.5.dylib',
'plist': {
'CFBundleIdentifier': 'org.tryton',
'CFBundleName': 'Tryton',
},
'iconfile': os.path.join('tryton', 'data', 'pixmaps',
'tryton', 'tryton.icns'),
},
}
del package_data['tryton']
def get_version():
init = read(os.path.join('tryton', '__init__.py'))
@@ -168,223 +111,3 @@ dist = setup(name=name,
zip_safe=False,
**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', 'gdk-pixbuf-query-loaders.exe'):
if os.path.isfile(os.path.join(directory, file)):
return os.path.dirname(directory)
return None
def find_makensis():
default_path = os.path.join(os.environ['PROGRAMFILES'], 'NSIS')
for directory in os.environ['PATH'].split(';') + [default_path]:
if not os.path.isdir(directory):
continue
path = os.path.join(directory, 'makensis.exe')
if os.path.isfile(path):
return path
return None
if 'py2exe' in dist.commands:
import shutil
gtk_dir = find_gtk_dir()
dist_dir = dist.command_obj['py2exe'].dist_dir
for dirname in ['plugins', 'data']:
if os.path.isdir(os.path.join(dist_dir, dirname)):
shutil.rmtree(os.path.join(dist_dir, dirname))
shutil.copytree(os.path.join(os.path.dirname(__file__), 'tryton',
dirname), os.path.join(dist_dir, dirname))
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'))
from subprocess import Popen, PIPE
query_loaders = Popen(os.path.join(gtk_dir, 'bin',
'gdk-pixbuf-query-loaders'), stdout=PIPE).stdout.read()
query_loaders = query_loaders.replace(
gtk_dir.replace(os.sep, '/') + '/', '')
loaders_path = os.path.join(dist_dir, 'etc', 'gtk-2.0',
'gdk-pixbuf.loaders')
with open(loaders_path, 'w') as loaders:
loaders.writelines([line + "\n" for line in
query_loaders.split(os.linesep)])
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 file in glob.iglob(os.path.join(gtk_dir, 'bin', '*.dll')):
if os.path.isfile(file):
shutil.copy(file, dist_dir)
if os.path.isdir(os.path.join(dist_dir, 'share', 'locale')):
shutil.rmtree(os.path.join(dist_dir, 'share', 'locale'))
shutil.copytree(os.path.join(gtk_dir, 'share', 'locale'),
os.path.join(dist_dir, 'share', 'locale'))
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'))
makensis = find_makensis()
if makensis:
from subprocess import Popen
Popen([makensis, "/DVERSION=" + version,
str(os.path.join(os.path.dirname(__file__),
'setup.nsi'))]).wait()
Popen([makensis, "/DVERSION=" + version,
str(os.path.join(os.path.dirname(__file__),
'setup-single.nsi'))]).wait()
else:
print "makensis.exe not found: installers can not be created, "\
"skip setup.nsi and setup-single.nsi"
elif sys.platform == 'darwin':
def find_gtk_dir():
for directory in os.environ['PATH'].split(':'):
if not os.path.isdir(directory):
continue
for file in ('gtk-demo',):
if os.path.isfile(os.path.join(directory, file)):
return os.path.dirname(directory)
return None
if 'py2app' in dist.commands:
import shutil
from subprocess import Popen, PIPE
from itertools import chain
from glob import iglob
gtk_dir = find_gtk_dir()
gtk_binary_version = Popen(['pkg-config',
'--variable=gtk_binary_version', 'gtk+-2.0'],
stdout=PIPE).stdout.read().strip()
dist_dir = dist.command_obj['py2app'].dist_dir
resources_dir = os.path.join(dist_dir, 'Tryton.app', 'Contents',
'Resources')
gtk_2_dist_dir = os.path.join(resources_dir, 'lib', 'gtk-2.0')
pango_dist_dir = os.path.join(resources_dir, 'lib', 'pango')
if os.path.isdir(pango_dist_dir):
shutil.rmtree(pango_dist_dir)
shutil.copytree(os.path.join(gtk_dir, 'lib', 'pango'), pango_dist_dir)
query_pango = Popen(os.path.join(gtk_dir, 'bin', 'pango-querymodules'),
stdout=PIPE).stdout.read()
query_pango = query_pango.replace(gtk_dir,
'@executable_path/../Resources')
pango_modules_path = os.path.join(resources_dir, 'pango.modules')
with open(pango_modules_path, 'w') as pango_modules:
pango_modules.write(query_pango)
with open(os.path.join(resources_dir, 'pangorc'), 'w') as pangorc:
pangorc.write('[Pango]\n')
pangorc.write('ModuleFiles=./pango.modules\n')
if not os.path.isdir(os.path.join(gtk_2_dist_dir, gtk_binary_version,
'engines')):
os.makedirs(os.path.join(gtk_2_dist_dir, gtk_binary_version,
'engines'))
shutil.copyfile(os.path.join(gtk_dir, 'lib', 'gtk-2.0',
gtk_binary_version, 'engines', 'libclearlooks.so'),
os.path.join(gtk_2_dist_dir, gtk_binary_version, 'engines',
'libclearlooks.so'))
query_loaders = Popen(os.path.join(gtk_dir, 'bin',
'gdk-pixbuf-query-loaders'), stdout=PIPE).stdout.read()
loader_dir, = re.findall('# LoaderDir = (.*)', query_loaders)
loader_pkg = (loader_dir.replace(os.path.join(gtk_dir, 'lib'),
'').split(os.path.sep)[-3])
loader_dist_dir = os.path.join(resources_dir, 'lib', loader_pkg,
gtk_binary_version, 'loaders')
if os.path.isdir(loader_dist_dir):
shutil.rmtree(loader_dist_dir)
if os.path.isdir(loader_dir):
shutil.copytree(loader_dir, loader_dist_dir)
query_loaders = query_loaders.replace(gtk_dir,
'@executable_path/../Resources')
loaders_path = os.path.join(resources_dir, 'gdk-pixbuf.loaders')
with open(loaders_path, 'w') as loaders:
loaders.write(query_loaders)
if os.path.isdir(os.path.join(gtk_2_dist_dir, gtk_binary_version,
'immodules')):
shutil.rmtree(os.path.join(gtk_2_dist_dir, gtk_binary_version,
'immodules'))
shutil.copytree(os.path.join(gtk_dir, 'lib', 'gtk-2.0',
gtk_binary_version, 'immodules'), os.path.join(gtk_2_dist_dir,
gtk_binary_version, 'immodules'))
query_immodules = Popen(os.path.join(gtk_dir, 'bin',
'gtk-query-immodules-2.0'), stdout=PIPE).stdout.read()
query_immodules = query_immodules.replace(gtk_dir,
'@executable_path/../Resources')
immodules_path = os.path.join(resources_dir, 'gtk.immodules')
with open(immodules_path, 'w') as immodules:
immodules.write(query_immodules)
with open(os.path.join(resources_dir, 'gtkrc'), 'w') as gtkrc:
for name, dirname in (
('Clearlooks', 'gtk-2.0'),
('Mac', 'gtk-2.0-key'),
):
rcfile = os.path.join(gtk_dir, 'share', 'themes', name,
dirname, 'gtkrc')
gtkrc.write(open(rcfile).read())
if os.path.isdir(os.path.join(resources_dir, 'share', 'locale')):
shutil.rmtree(os.path.join(resources_dir, 'share', 'locale'))
shutil.copytree(os.path.join(gtk_dir, 'share', 'locale'),
os.path.join(resources_dir, 'share', 'locale'))
# fix pathes within shared libraries
for library in chain(
iglob(os.path.join(loader_dist_dir, '*.so')),
iglob(os.path.join(gtk_2_dist_dir, gtk_binary_version,
'engines', '*.so')),
iglob(os.path.join(gtk_2_dist_dir, gtk_binary_version,
'immodules', '*.so')),
iglob(os.path.join(pango_dist_dir, '*', 'modules', '*.so'))):
libs = [lib.split('(')[0].strip()
for lib in Popen(['otool', '-L', library],
stdout=PIPE).communicate()[0].splitlines()
if 'compatibility' in lib]
libs = dict(((lib, None) for lib in libs if gtk_dir in lib))
for lib in libs.keys():
fixed = lib.replace(gtk_dir + '/lib',
'@executable_path/../Frameworks')
Popen(['install_name_tool', '-change', lib, fixed, library]
).wait()
for file in ('CHANGELOG', 'COPYRIGHT', 'LICENSE', 'README'):
shutil.copyfile(os.path.join(os.path.dirname(__file__), file),
os.path.join(dist_dir, file + '.txt'))
doc_dist_dir = os.path.join(dist_dir, 'doc')
if os.path.isdir(doc_dist_dir):
shutil.rmtree(doc_dist_dir)
shutil.copytree(os.path.join(os.path.dirname(__file__), 'doc'),
doc_dist_dir)
dmg_file = os.path.join(os.path.dirname(__file__), 'tryton-' + version
+ '.dmg')
if os.path.isfile(dmg_file):
os.remove(dmg_file)
Popen(['hdiutil', 'create', dmg_file, '-volname', 'Tryton Client '
+ version, '-fs', 'HFS+', '-srcfolder', dist_dir]).wait()
+5
View File
@@ -17,6 +17,11 @@ import pygtk
pygtk.require('2.0')
import gtk
import gobject
try:
# Import earlier otherwise there is a segmentation fault on MSYS2
import goocalendar
except ImportError:
pass
gobject.threads_init()
from urlparse import urlparse
import threading
+1 -7
View File
@@ -165,15 +165,9 @@ class ConfigManager(object):
CONFIG = ConfigManager()
CURRENT_DIR = unicode(os.path.dirname(__file__),
sys.getfilesystemencoding())
if (os.name == 'nt' and hasattr(sys, 'frozen')
and os.path.basename(sys.executable) == 'tryton.exe'):
if hasattr(sys, 'frozen'):
CURRENT_DIR = os.path.dirname(unicode(sys.executable,
sys.getfilesystemencoding()))
elif (os.name == 'mac'
or (hasattr(os, 'uname') and os.uname()[0] == 'Darwin')):
resources = os.path.join(os.path.dirname(sys.argv[0]), '..', 'Resources')
if os.path.isdir(resources):
CURRENT_DIR = resources
PIXMAPS_DIR = os.path.join(CURRENT_DIR, 'data', 'pixmaps', 'tryton')
if not os.path.isdir(PIXMAPS_DIR):
+14
View File
@@ -0,0 +1,14 @@
# GdkPixbuf Image Loader Modules file
# Automatically generated file, do not edit
# Created by gdk-pixbuf-query-loaders.exe from gdk-pixbuf-2.35.4
#
# LoaderDir = C:\msys32\mingw32/lib/gdk-pixbuf-2.0/2.10.0/loaders
#
"lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-svg.dll"
"svg" 6 "gdk-pixbuf" "Scalable Vector Graphics" "LGPL"
"image/svg+xml" "image/svg" "image/svg-xml" "image/vnd.adobe.svg+xml" "text/xml-svg" "image/svg+xml-compressed" ""
"svg" "svgz" "svg.gz" ""
" <svg" "* " 100
" <!DOCTYPE svg" "* " 100
View File
Whitespace-only changes.
View File
Whitespace-only changes.