mirror of
https://github.com/shlomif/PySolFC.git
synced 2025-04-05 00:02:29 -04:00
setup*.py: Install locale/ also on macOS and Windows
This commit is contained in:
parent
bd4be45118
commit
8bef9848a5
2 changed files with 18 additions and 13 deletions
28
setup.py
28
setup.py
|
@ -2,7 +2,6 @@
|
|||
# -*- mode: python; -*-
|
||||
|
||||
import os
|
||||
from glob import glob
|
||||
|
||||
from pysollib.settings import PACKAGE_URL
|
||||
from pysollib.settings import VERSION
|
||||
|
@ -12,12 +11,22 @@ from setuptools import setup
|
|||
if os.name == 'nt':
|
||||
import py2exe # noqa: F401
|
||||
|
||||
|
||||
def get_data_files(source, destination):
|
||||
"""Iterates over all files under the given tree, to install them to the
|
||||
destination using the data_files keyword of setuptools.setup."""
|
||||
for path, _, files in os.walk(source):
|
||||
files = [os.path.join(path, f) for f in files]
|
||||
path = path.replace(source, destination, 1)
|
||||
yield (path, files)
|
||||
|
||||
|
||||
if os.name == 'posix':
|
||||
data_dir = 'share/PySolFC'
|
||||
elif os.name == 'nt':
|
||||
data_dir = 'data'
|
||||
locale_dir = 'share/locale'
|
||||
else:
|
||||
data_dir = 'data'
|
||||
locale_dir = 'locale'
|
||||
|
||||
ddirs = [
|
||||
'html',
|
||||
|
@ -35,21 +44,16 @@ for s in open('MANIFEST.in'):
|
|||
data_files = []
|
||||
|
||||
for d in ddirs:
|
||||
for root, dirs, files in os.walk(os.path.join('data', d)):
|
||||
if root.find('.svn') >= 0:
|
||||
continue
|
||||
if files:
|
||||
# files = map(lambda f: os.path.join(root, f), files)
|
||||
files = [os.path.join(root, f) for f in files]
|
||||
data_files.append((os.path.join(data_dir, root[5:]), files))
|
||||
data_files += get_data_files(os.path.join('data', d),
|
||||
os.path.join(data_dir, d))
|
||||
|
||||
data_files += get_data_files('locale', locale_dir)
|
||||
|
||||
if os.name == 'posix':
|
||||
data_files.append(('share/pixmaps', ['data/pysol.xbm', 'data/pysol.xpm']))
|
||||
for size in os.listdir('data/images/icons'):
|
||||
data_files.append(('share/icons/hicolor/%s/apps' % size,
|
||||
['data/images/icons/%s/pysol.png' % size]))
|
||||
for mofile in glob('locale/*/*/*.mo'):
|
||||
data_files.append(('share/' + os.path.dirname(mofile), [mofile]))
|
||||
data_files.append((data_dir, ['data/pysolfc.glade']))
|
||||
data_files.append(('share/applications', ['data/pysol.desktop']))
|
||||
|
||||
|
|
|
@ -52,7 +52,8 @@ PLIST = dict(
|
|||
)
|
||||
APP = ['pysol.py']
|
||||
ICON_FILE = 'data/PySol.icns'
|
||||
DATA_FILES = ['docs', 'data', 'scripts', 'COPYING', 'README.md'] + SOLVER
|
||||
DATA_FILES = ['docs', 'data', 'locale', 'scripts', 'COPYING', 'README.md',
|
||||
] + SOLVER
|
||||
RESOURCES = []
|
||||
FRAMEWORKS = [SOLVER_LIB_PATH] if SOLVER_LIB_PATH else []
|
||||
OPTIONS = dict(argv_emulation=True,
|
||||
|
|
Loading…
Add table
Reference in a new issue