17 |
|
|
18 |
import os |
import os |
19 |
from types import TupleType |
from types import TupleType |
20 |
|
import glob |
21 |
from distutils.core import setup, Extension, Command |
from distutils.core import setup, Extension, Command |
22 |
from distutils.command.install import install, INSTALL_SCHEMES, subst_vars |
from distutils.command.install import install, INSTALL_SCHEMES, subst_vars |
23 |
from distutils.command.build_py import build_py |
from distutils.command.build_py import build_py |
265 |
data_files = [] |
data_files = [] |
266 |
|
|
267 |
# bitmaps |
# bitmaps |
268 |
dir = "Resources/Bitmaps" |
for d, pattern in [("Resources/Bitmaps", "Resources/Bitmaps/*.xpm"), |
269 |
bitmaps = [] |
("Resources/Locale", "Resources/Locale/*/LC_MESSAGES/*.mo") |
270 |
for file in os.listdir(os.path.join("Resources", "Bitmaps")): |
]: |
271 |
if string.lower(file[-4:]) == ".xpm": |
data_files.append((d, glob.glob(pattern))) |
|
bitmaps.append(dir + '/' + file) |
|
|
data_files.append((dir, bitmaps)) |
|
272 |
|
|
273 |
# |
# |
274 |
# Command definitions |
# Command definitions |
755 |
cp extensions/pyprojection/{LICENSE,LICENSE.pyprojection} |
cp extensions/pyprojection/{LICENSE,LICENSE.pyprojection} |
756 |
''' |
''' |
757 |
|
|
758 |
|
bdist_rpm_build_script = ''' |
759 |
|
env PATH="$PATH:%(prefix)s/lib/wxPython/bin:/usr/lib/wxPython/bin" CFLAGS="$RPM_OPT_FLAGS" %(python)s setup.py build |
760 |
|
''' |
761 |
|
|
762 |
bdist_rpm_install_script = ''' |
bdist_rpm_install_script = ''' |
763 |
%(python)s setup.py install --root=$RPM_BUILD_ROOT --record=INSTALLED_FILES \ |
%(python)s setup.py install --root=$RPM_BUILD_ROOT --record=INSTALLED_FILES \ |
764 |
--prefix=%(prefix)s |
--prefix=%(prefix)s |
782 |
# scripts such as the python interpreter to use are only known |
# scripts such as the python interpreter to use are only known |
783 |
# then. |
# then. |
784 |
open("bdist_rpm_prep", "w").close() |
open("bdist_rpm_prep", "w").close() |
785 |
|
open("bdist_rpm_build", "w").close() |
786 |
open("bdist_rpm_install", "w").close() |
open("bdist_rpm_install", "w").close() |
787 |
bdist_rpm.initialize_options(self) |
bdist_rpm.initialize_options(self) |
788 |
|
|
790 |
# create the scripts for the spec-file. Now we know the python |
# create the scripts for the spec-file. Now we know the python |
791 |
# interpreter to use. |
# interpreter to use. |
792 |
open("bdist_rpm_prep", "w").write(bdist_rpm_prep_script) |
open("bdist_rpm_prep", "w").write(bdist_rpm_prep_script) |
793 |
|
|
794 |
|
build = bdist_rpm_build_script % {"python": self.python, |
795 |
|
"prefix": self.prefix} |
796 |
|
open("bdist_rpm_build", "w").write(build) |
797 |
|
|
798 |
install = bdist_rpm_install_script % {"python": self.python, |
install = bdist_rpm_install_script % {"python": self.python, |
799 |
"prefix": self.prefix} |
"prefix": self.prefix} |
800 |
open("bdist_rpm_install", "w").write(install) |
open("bdist_rpm_install", "w").write(install) |
882 |
"""Execute the command. install_options if given, should be a |
"""Execute the command. install_options if given, should be a |
883 |
directory of additional options to set in the install step""" |
directory of additional options to set in the install step""" |
884 |
# Obviously have to build before we can install |
# Obviously have to build before we can install |
885 |
|
|
886 |
if not self.skip_build: |
if not self.skip_build: |
887 |
self.run_command('build') |
self.run_command('build') |
888 |
|
|
995 |
def run(self): |
def run(self): |
996 |
install_options = { |
install_options = { |
997 |
"prefix": ".", |
"prefix": ".", |
998 |
|
"install_lib": "$base", |
999 |
|
"install_data": "$base", |
1000 |
"install_scripts": "$base", |
"install_scripts": "$base", |
1001 |
"warn_dir": 0, |
"warn_dir": 0, |
1002 |
"extra_files": ["COPYING", "Lib/proj.dll"], |
"extra_files": ["COPYING", "Lib/proj.dll"], |
1004 |
# don't make a symlink because we're simulating windows, so |
# don't make a symlink because we're simulating windows, so |
1005 |
# that we can generate the iss-file even on Linux |
# that we can generate the iss-file even on Linux |
1006 |
install_options["do_symlink"] = 0 |
install_options["do_symlink"] = 0 |
1007 |
|
|
1008 |
bdist_inno.run(self, install_options) |
bdist_inno.run(self, install_options) |
1009 |
|
|
1010 |
|
class thuban_build_docs(Command): |
1011 |
|
|
1012 |
|
"""Command to generate documentation from source code.""" |
1013 |
|
|
1014 |
|
description = "Generate documentation." |
1015 |
|
|
1016 |
|
user_options = [] |
1017 |
|
|
1018 |
|
def initialize_options(self): pass |
1019 |
|
|
1020 |
|
def finalize_options(self): pass |
1021 |
|
|
1022 |
|
def run(self, install_options = None): |
1023 |
|
self.spawn(["happydoc", "-d./Doc", "./Thuban"]) |
1024 |
|
|
1025 |
# |
# |
1026 |
# Run the script |
# Run the script |
1074 |
"install": ThubanInstall, |
"install": ThubanInstall, |
1075 |
"bdist_rpm": thuban_bdist_rpm, |
"bdist_rpm": thuban_bdist_rpm, |
1076 |
"bdist_inno": thuban_bdist_inno, |
"bdist_inno": thuban_bdist_inno, |
1077 |
"data_dist": data_dist |
"data_dist": data_dist, |
1078 |
|
"build_docs": thuban_build_docs |
1079 |
}) |
}) |
1080 |
|
|
1081 |
|
|