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 |
228 |
library_dirs = [proj4_libdir] + wx_libdirs, |
library_dirs = [proj4_libdir] + wx_libdirs, |
229 |
libraries = [proj4_lib] + wx_libs)) |
libraries = [proj4_lib] + wx_libs)) |
230 |
|
|
231 |
|
extensions.append(Extension("Lib.gdalwarp", |
232 |
|
[ext_dir + "/thuban/gdalwarp.cpp", |
233 |
|
ext_dir + "/thuban/cpl_mfile.cpp", |
234 |
|
ext_dir + "/thuban/bmpdataset.cpp"], |
235 |
|
libraries = [proj4_lib] + ["gdal.1.1"])) |
236 |
|
|
237 |
|
|
238 |
# |
# |
239 |
# shapelib wrappers are also distributed with thuban |
# shapelib wrappers are also distributed with thuban |
240 |
# |
# |
272 |
data_files = [] |
data_files = [] |
273 |
|
|
274 |
# bitmaps |
# bitmaps |
275 |
dir = "Resources/Bitmaps" |
for d, pattern in [("Resources/Bitmaps", "Resources/Bitmaps/*.xpm"), |
276 |
bitmaps = [] |
("Resources/Locale", "Resources/Locale/*/LC_MESSAGES/*.mo") |
277 |
for file in os.listdir(os.path.join("Resources", "Bitmaps")): |
]: |
278 |
if string.lower(file[-4:]) == ".xpm": |
data_files.append((d, glob.glob(pattern))) |
|
bitmaps.append(dir + '/' + file) |
|
|
data_files.append((dir, bitmaps)) |
|
279 |
|
|
280 |
# |
# |
281 |
# Command definitions |
# Command definitions |
762 |
cp extensions/pyprojection/{LICENSE,LICENSE.pyprojection} |
cp extensions/pyprojection/{LICENSE,LICENSE.pyprojection} |
763 |
''' |
''' |
764 |
|
|
765 |
|
bdist_rpm_build_script = ''' |
766 |
|
env PATH="$PATH:%(prefix)s/lib/wxPython/bin:/usr/lib/wxPython/bin" CFLAGS="$RPM_OPT_FLAGS" %(python)s setup.py build |
767 |
|
''' |
768 |
|
|
769 |
bdist_rpm_install_script = ''' |
bdist_rpm_install_script = ''' |
770 |
%(python)s setup.py install --root=$RPM_BUILD_ROOT --record=INSTALLED_FILES \ |
%(python)s setup.py install --root=$RPM_BUILD_ROOT --record=INSTALLED_FILES \ |
771 |
--prefix=%(prefix)s |
--prefix=%(prefix)s |
789 |
# scripts such as the python interpreter to use are only known |
# scripts such as the python interpreter to use are only known |
790 |
# then. |
# then. |
791 |
open("bdist_rpm_prep", "w").close() |
open("bdist_rpm_prep", "w").close() |
792 |
|
open("bdist_rpm_build", "w").close() |
793 |
open("bdist_rpm_install", "w").close() |
open("bdist_rpm_install", "w").close() |
794 |
bdist_rpm.initialize_options(self) |
bdist_rpm.initialize_options(self) |
795 |
|
|
797 |
# create the scripts for the spec-file. Now we know the python |
# create the scripts for the spec-file. Now we know the python |
798 |
# interpreter to use. |
# interpreter to use. |
799 |
open("bdist_rpm_prep", "w").write(bdist_rpm_prep_script) |
open("bdist_rpm_prep", "w").write(bdist_rpm_prep_script) |
800 |
|
|
801 |
|
build = bdist_rpm_build_script % {"python": self.python, |
802 |
|
"prefix": self.prefix} |
803 |
|
open("bdist_rpm_build", "w").write(build) |
804 |
|
|
805 |
install = bdist_rpm_install_script % {"python": self.python, |
install = bdist_rpm_install_script % {"python": self.python, |
806 |
"prefix": self.prefix} |
"prefix": self.prefix} |
807 |
open("bdist_rpm_install", "w").write(install) |
open("bdist_rpm_install", "w").write(install) |