Use package_data instead of data_files
package_data must be used for data that are closely related to the package's implemenation. This is the case of the pixmaps and the locale. issue4983 review24421002
@@ -13,11 +13,3 @@ include doc/*
|
||||
recursive-include doc *.rst
|
||||
recursive-include doc *.po
|
||||
recursive-include doc *.pot
|
||||
include share/pixmaps/tryton/LICENSE
|
||||
include share/pixmaps/tryton/*.png
|
||||
include share/pixmaps/tryton/*.svg
|
||||
include share/pixmaps/tryton/*.ico
|
||||
include share/pixmaps/tryton/*.icns
|
||||
recursive-include share/locale *.mo
|
||||
recursive-include share/locale *.po
|
||||
include share/locale/*.pot
|
||||
|
||||
@@ -24,9 +24,6 @@ Package Contents
|
||||
|
||||
python doc/build.py
|
||||
|
||||
share/
|
||||
The shared files like translations and images.
|
||||
|
||||
tryton/
|
||||
tryton sources.
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ OutFile "tryton-${VERSION}.exe"
|
||||
SetCompressor lzma
|
||||
SetCompress auto
|
||||
SilentInstall silent
|
||||
Icon "share\pixmaps\tryton\tryton.ico"
|
||||
Icon "tryton\data\pixmaps\tryton\tryton.ico"
|
||||
|
||||
Section
|
||||
InitPluginsDir
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
[extract_messages]
|
||||
copyright_holder = Tryton
|
||||
msgid_bugs_address = issue_tracker@tryton.org
|
||||
output_file = share/locale/tryton.pot
|
||||
output_file = tryton/data/locale/tryton.pot
|
||||
keywords = _, gettext
|
||||
|
||||
[init_catalog]
|
||||
domain = tryton
|
||||
input_file = share/locale/tryton.pot
|
||||
output_dir = share/locale
|
||||
input_file = tryton/data/locale/tryton.pot
|
||||
output_dir = tryton/data/locale
|
||||
|
||||
[compile_catalog]
|
||||
domain = tryton
|
||||
directory = share/locale
|
||||
directory = tryton/data/locale
|
||||
|
||||
[update_catalog]
|
||||
domain = tryton
|
||||
input_file = share/locale/tryton.pot
|
||||
output_dir = share/locale
|
||||
input_file = tryton/data/locale/tryton.pot
|
||||
output_dir = tryton/data/locale
|
||||
|
||||
@@ -41,7 +41,7 @@ Var STARTMENU_FOLDER
|
||||
|
||||
;Pages
|
||||
|
||||
!define MUI_ICON "share\pixmaps\tryton\tryton.ico"
|
||||
!define MUI_ICON "tryton\data\pixmaps\tryton\tryton.ico"
|
||||
!define MUI_LICENSEPAGE_TEXT_BOTTOM "$(LicenseText)"
|
||||
!define MUI_LICENSEPAGE_BUTTON "$(LicenseNext)"
|
||||
|
||||
|
||||
@@ -33,44 +33,15 @@ try:
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
languages = (
|
||||
'bg_BG',
|
||||
'ca_ES',
|
||||
'cs_CZ',
|
||||
'de_DE',
|
||||
'es_AR',
|
||||
'es_CO',
|
||||
'es_EC',
|
||||
'es_ES',
|
||||
'es_MX',
|
||||
'fr_FR',
|
||||
'hu_HU',
|
||||
'it_IT',
|
||||
'ja_JP',
|
||||
'lt_LT',
|
||||
'nl_NL',
|
||||
'pt_BR',
|
||||
'ru_RU',
|
||||
'sl_SI',
|
||||
)
|
||||
|
||||
|
||||
def all_languages():
|
||||
for lang in languages:
|
||||
yield lang
|
||||
yield lang.split('_')[0]
|
||||
|
||||
data_files = [
|
||||
('share/pixmaps/tryton', glob.glob('share/pixmaps/tryton/*.png') +
|
||||
glob.glob('share/pixmaps/tryton/*.svg')),
|
||||
('share/locale', ['share/locale/tryton.pot']),
|
||||
]
|
||||
for lang in languages:
|
||||
data_files += [
|
||||
('share/locale/%s/LC_MESSAGES' % lang,
|
||||
glob.glob('share/locale/%s/LC_MESSAGES/*.mo' % lang) +
|
||||
glob.glob('share/locale/%s/LC_MESSAGES/*.po' % lang)),
|
||||
package_data = {
|
||||
'tryton': ['data/pixmaps/tryton/*.png',
|
||||
'data/pixmaps/tryton/*.svg',
|
||||
'data/locale/tryton.pot',
|
||||
'data/locale/*/LC_MESSAGES/*.mo',
|
||||
'data/locale/*/LC_MESSAGES/*.po',
|
||||
]
|
||||
}
|
||||
data_files = []
|
||||
|
||||
if os.name == 'nt':
|
||||
import py2exe
|
||||
@@ -78,7 +49,8 @@ if os.name == 'nt':
|
||||
args['windows'] = [{
|
||||
'script': os.path.join('bin', 'tryton'),
|
||||
'icon_resources': [
|
||||
(1, os.path.join('share', 'pixmaps', 'tryton', 'tryton.ico'))],
|
||||
(1, os.path.join('tryton', 'data', 'pixmaps',
|
||||
'tryton', 'tryton.ico'))],
|
||||
}]
|
||||
args['options'] = {
|
||||
'py2exe': {
|
||||
@@ -113,17 +85,18 @@ elif sys.platform == 'darwin':
|
||||
'argv_emulation': True,
|
||||
'includes': ('pygtk, gtk, glib, cairo, pango, pangocairo, atk, '
|
||||
'gobject, gio, gtk.keysyms'),
|
||||
'resources': 'tryton/plugins',
|
||||
'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('share', 'pixmaps', 'tryton',
|
||||
'tryton.icns'),
|
||||
'iconfile': os.path.join('tryton', 'data', 'pixmaps',
|
||||
'tryton', 'tryton.icns'),
|
||||
},
|
||||
}
|
||||
del package_data['tryton']
|
||||
|
||||
|
||||
def get_version():
|
||||
@@ -153,6 +126,7 @@ dist = setup(name=name,
|
||||
download_url=download_url,
|
||||
keywords='business application ERP',
|
||||
packages=find_packages(),
|
||||
package_data=package_data,
|
||||
data_files=data_files,
|
||||
scripts=['bin/tryton'],
|
||||
classifiers=[
|
||||
@@ -222,10 +196,11 @@ if os.name == 'nt':
|
||||
|
||||
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'))
|
||||
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'))
|
||||
@@ -253,17 +228,10 @@ if os.name == 'nt':
|
||||
if os.path.isfile(file):
|
||||
shutil.copy(file, dist_dir)
|
||||
|
||||
for lang in all_languages():
|
||||
if os.path.isdir(os.path.join(dist_dir, 'share', 'locale', lang)):
|
||||
shutil.rmtree(os.path.join(dist_dir, 'share', 'locale', lang))
|
||||
if os.path.isdir(os.path.join(gtk_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(os.path.dirname(__file__),
|
||||
'share', 'locale', lang)):
|
||||
shutil.copytree(os.path.join(os.path.dirname(__file__),
|
||||
'share', 'locale', lang),
|
||||
os.path.join(dist_dir, 'share', 'locale', lang))
|
||||
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')):
|
||||
@@ -380,19 +348,10 @@ elif sys.platform == 'darwin':
|
||||
dirname, 'gtkrc')
|
||||
gtkrc.write(open(rcfile).read())
|
||||
|
||||
for lang in all_languages():
|
||||
if os.path.isdir(os.path.join(resources_dir, 'share', 'locale',
|
||||
lang)):
|
||||
shutil.rmtree(os.path.join(resources_dir, 'share', 'locale',
|
||||
lang))
|
||||
if os.path.isdir(os.path.join(gtk_dir, 'share', 'locale', lang)):
|
||||
shutil.copytree(os.path.join(gtk_dir, 'share', 'locale', lang),
|
||||
os.path.join(resources_dir, 'share', 'locale', lang))
|
||||
if os.path.isdir(os.path.join(os.path.dirname(__file__),
|
||||
'share', 'locale', lang)):
|
||||
shutil.copytree(os.path.join(os.path.dirname(__file__),
|
||||
'share', 'locale', lang),
|
||||
os.path.join(resources_dir, 'share', 'locale', lang))
|
||||
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(
|
||||
|
||||
@@ -9,7 +9,7 @@ import logging
|
||||
import sys
|
||||
import locale
|
||||
import gtk
|
||||
import site
|
||||
import pkg_resources
|
||||
|
||||
from tryton.exceptions import TrytonError
|
||||
from tryton import __version__
|
||||
@@ -164,27 +164,22 @@ class ConfigManager(object):
|
||||
self.defaults.get(key)))
|
||||
|
||||
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'):
|
||||
CURRENT_DIR = os.path.dirname(unicode(sys.executable,
|
||||
sys.getfilesystemencoding()))
|
||||
else:
|
||||
CURRENT_DIR = os.path.abspath(os.path.normpath(os.path.join(
|
||||
unicode(os.path.dirname(__file__), 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
|
||||
|
||||
for dir in [CURRENT_DIR, getattr(site, 'USER_BASE', sys.prefix), sys.prefix]:
|
||||
PIXMAPS_DIR = os.path.join(dir, 'share', 'pixmaps', 'tryton')
|
||||
if os.path.isdir(PIXMAPS_DIR):
|
||||
break
|
||||
PIXMAPS_DIR = os.path.join(CURRENT_DIR, 'data', 'pixmaps', 'tryton')
|
||||
if not os.path.isdir(PIXMAPS_DIR):
|
||||
PIXMAPS_DIR = pkg_resources.resource_filename(
|
||||
'tryton', 'data/pixmaps/tryton')
|
||||
|
||||
TRYTON_ICON = gtk.gdk.pixbuf_new_from_file(
|
||||
os.path.join(PIXMAPS_DIR, 'tryton-icon.png').encode('utf-8'))
|
||||
|
||||
|
||||
def _data_dir():
|
||||
data_dir = os.path.join(CURRENT_DIR, 'share', 'tryton')
|
||||
if not os.path.isdir(data_dir):
|
||||
data_dir = os.path.join(sys.prefix, 'share', 'tryton')
|
||||
return data_dir
|
||||
DATA_DIR = _data_dir()
|
||||
os.path.join(PIXMAPS_DIR, 'tryton-icon.png').encode('utf-8'))
|
||||
|
||||
|
Before Width: | Height: | Size: 9.0 KiB After Width: | Height: | Size: 9.0 KiB |
|
Before Width: | Height: | Size: 7.1 KiB After Width: | Height: | Size: 7.1 KiB |
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 19 KiB |
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 61 KiB After Width: | Height: | Size: 61 KiB |
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 54 KiB After Width: | Height: | Size: 54 KiB |
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 45 KiB After Width: | Height: | Size: 45 KiB |
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 72 KiB After Width: | Height: | Size: 72 KiB |
|
Before Width: | Height: | Size: 9.6 KiB After Width: | Height: | Size: 9.6 KiB |
|
Before Width: | Height: | Size: 45 KiB After Width: | Height: | Size: 45 KiB |
|
Before Width: | Height: | Size: 35 KiB After Width: | Height: | Size: 35 KiB |
|
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 24 KiB |
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 21 KiB |
|
Before Width: | Height: | Size: 7.9 KiB After Width: | Height: | Size: 7.9 KiB |
|
Before Width: | Height: | Size: 7.7 KiB After Width: | Height: | Size: 7.7 KiB |
|
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 28 KiB |
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
|
Before Width: | Height: | Size: 786 B After Width: | Height: | Size: 786 B |
|
Before Width: | Height: | Size: 5.1 KiB After Width: | Height: | Size: 5.1 KiB |
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 30 KiB After Width: | Height: | Size: 30 KiB |
|
Before Width: | Height: | Size: 9.6 KiB After Width: | Height: | Size: 9.6 KiB |
|
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 19 KiB |
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 21 KiB |
|
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 17 KiB |
|
Before Width: | Height: | Size: 172 B After Width: | Height: | Size: 172 B |
|
Before Width: | Height: | Size: 30 KiB After Width: | Height: | Size: 30 KiB |
|
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 23 KiB |
|
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 19 KiB |
|
Before Width: | Height: | Size: 30 KiB After Width: | Height: | Size: 30 KiB |
|
Before Width: | Height: | Size: 36 KiB After Width: | Height: | Size: 36 KiB |
|
Before Width: | Height: | Size: 34 KiB After Width: | Height: | Size: 34 KiB |
|
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 22 KiB |
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 31 KiB After Width: | Height: | Size: 31 KiB |
|
Before Width: | Height: | Size: 29 KiB After Width: | Height: | Size: 29 KiB |
|
Before Width: | Height: | Size: 4.6 KiB After Width: | Height: | Size: 4.6 KiB |
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 36 KiB After Width: | Height: | Size: 36 KiB |
|
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 26 KiB |
|
Before Width: | Height: | Size: 31 KiB After Width: | Height: | Size: 31 KiB |
|
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 25 KiB |
|
Before Width: | Height: | Size: 9.0 KiB After Width: | Height: | Size: 9.0 KiB |
|
Before Width: | Height: | Size: 4.4 KiB After Width: | Height: | Size: 4.4 KiB |
|
Before Width: | Height: | Size: 49 KiB After Width: | Height: | Size: 49 KiB |
|
Before Width: | Height: | Size: 61 KiB After Width: | Height: | Size: 61 KiB |
|
Before Width: | Height: | Size: 36 KiB After Width: | Height: | Size: 36 KiB |
@@ -1,11 +1,10 @@
|
||||
# This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
# this repository contains the full copyright notices and license terms.
|
||||
import os
|
||||
import sys
|
||||
import imp
|
||||
import gettext
|
||||
|
||||
from tryton.config import get_config_dir
|
||||
from tryton.config import get_config_dir, CURRENT_DIR
|
||||
|
||||
__all__ = ['MODULES', 'register']
|
||||
|
||||
@@ -18,10 +17,7 @@ def register():
|
||||
global MODULES
|
||||
paths = [
|
||||
os.path.join(get_config_dir(), 'plugins'),
|
||||
os.path.dirname(__file__),
|
||||
# py2exe
|
||||
os.path.join(os.path.abspath(os.path.normpath(
|
||||
os.path.dirname(sys.argv[0]))), 'plugins'),
|
||||
os.path.join(CURRENT_DIR, 'plugins'),
|
||||
]
|
||||
paths = filter(os.path.isdir, paths)
|
||||
|
||||
|
||||
@@ -4,10 +4,12 @@
|
||||
import os
|
||||
import locale
|
||||
import gettext
|
||||
from tryton.config import CURRENT_DIR
|
||||
import logging
|
||||
import gtk
|
||||
import sys
|
||||
import pkg_resources
|
||||
|
||||
from tryton.config import CURRENT_DIR
|
||||
|
||||
_ = gettext.gettext
|
||||
|
||||
@@ -152,9 +154,10 @@ _LOCALE2WIN32 = {
|
||||
|
||||
def setlang(lang=None, locale_dict=None):
|
||||
"Set language"
|
||||
locale_dir = os.path.join(CURRENT_DIR, 'share/locale')
|
||||
locale_dir = os.path.join(CURRENT_DIR, 'data/locale')
|
||||
if not os.path.isdir(locale_dir):
|
||||
locale_dir = os.path.join(sys.prefix, 'share/locale')
|
||||
locale_dir = pkg_resources.resource_filename(
|
||||
'tryton', 'data/locale')
|
||||
if lang:
|
||||
encoding = locale.getdefaultlocale()[1]
|
||||
if not encoding:
|
||||
|
||||