/[thuban]/branches/WIP-pyshapelib-bramz/setup.py
ViewVC logotype

Diff of /branches/WIP-pyshapelib-bramz/setup.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2478 by bh, Fri Dec 17 18:48:49 2004 UTC revision 2711 by dpinte, Tue Oct 10 10:30:54 2006 UTC
# Line 1  Line 1 
1  # Copyright (c) 2001, 2002, 2003, 2004 by Intevation GmbH  # Copyright (c) 2001, 2002, 2003, 2004, 2005 by Intevation GmbH
2  # Authors:  # Authors:
3  # Bernhard Herzog <[email protected]>  # Bernhard Herzog <[email protected]>
4  #  #
# Line 86  elif os.name == "nt": Line 86  elif os.name == "nt":
86      basedir = os.path.dirname(sys.argv[0])      basedir = os.path.dirname(sys.argv[0])
87    
88      # Directories where Proj4 is installed      # Directories where Proj4 is installed
89      proj4_prefix = os.path.join(basedir, "..", "proj-4.4.7", "src")      proj4_prefix = os.path.join(basedir, "..", "proj-4.4.9", "src")
90      proj4_incdir =  proj4_prefix      proj4_incdir =  proj4_prefix
91      proj4_libdir =  proj4_prefix      proj4_libdir =  proj4_prefix
92      proj4_lib = "proj_i"      proj4_lib = "proj_i"
93    
94      # Define include and lib directories for wxWindows and      # Define include and lib directories for wxWindows and
95      wx_prefix = os.path.join(basedir, "..", "wxPython-2.4.2.4")      wx_prefix = os.path.join(basedir, "..", "wxPython-2.6.3.3")
96      wx_inc = [os.path.join(wx_prefix, 'lib', 'mswdllh'),      wx_inc = [os.path.join(wx_prefix, 'lib', 'vc_dll', 'mswuh'),
97                os.path.join(wx_prefix, "include")]                os.path.join(wx_prefix, "include")]
98      wx_lib = [os.path.join(wx_prefix, "lib")]      wx_lib = [os.path.join(wx_prefix, "lib", "vc_dll")]
99    
100      # Define include and lib directories for GDAL      # Define include and lib directories for GDAL
101      gdal_prefix = os.path.join(basedir, "..", "gdal-1.1.8")      gdal_prefix = os.path.join(basedir, "..", "gdal-1.3.2")
102      gdal_inc = [os.path.join(gdal_prefix, 'alg'),      gdal_inc = [os.path.join(gdal_prefix, 'alg'),
103                  os.path.join(gdal_prefix, 'ogr'),                  os.path.join(gdal_prefix, 'ogr'),
104                  os.path.join(gdal_prefix, 'port'),                  os.path.join(gdal_prefix, 'port'),
105                    os.path.join(gdal_prefix, 'gcore'),
106                  os.path.join(gdal_prefix, 'core')]                  os.path.join(gdal_prefix, 'core')]
107      gdal_lib = [gdal_prefix]      gdal_lib = [gdal_prefix]
108    
# Line 153  elif os.name == "nt": Line 154  elif os.name == "nt":
154            
155      wx_cs_params[CS_INCDIRS] = wx_inc      wx_cs_params[CS_INCDIRS] = wx_inc
156      wx_cs_params[CS_LIBDIRS] = wx_lib      wx_cs_params[CS_LIBDIRS] = wx_lib
157      wx_cs_params[CS_LIBS] = ["wxmsw24h"] \      wx_cs_params[CS_LIBS] = ["wxmsw26uh"] \
158                        + ['kernel32', 'user32', 'gdi32', 'comdlg32',                        + ['kernel32', 'user32', 'gdi32', 'comdlg32',
159                           'winspool', 'winmm', 'shell32', 'oldnames',                           'winspool', 'winmm', 'shell32', 'oldnames',
160                           'comctl32', 'ctl3d32', 'odbc32', 'ole32', 'oleaut32',                           'comctl32', 'odbc32', 'ole32', 'oleaut32',
161                           'uuid', 'rpcrt4', 'advapi32', 'wsock32']                           'uuid', 'rpcrt4', 'advapi32', 'wsock32']
162    
163      gdal_config_script = ""      gdal_config_script = ""
# Line 252  py_modules = [] Line 253  py_modules = []
253  # Thuban specific modules  # Thuban specific modules
254  #  #
255    
256  extensions.append(Extension("Lib.wxproj",  wxproj_extension = Extension("Lib.wxproj",
257                              [ext_dir + "/thuban/wxproj.cpp"],                               [ext_dir + "/thuban/wxproj.cpp"],
258                              include_dirs = ([shp_dir, proj4_incdir,                               include_dirs = ([shp_dir, proj4_incdir,
259                                               ext_dir + "/pyshapelib/"]                                                ext_dir + "/pyshapelib/"]
260                                              + wx_cs_params[CS_INCDIRS]),                                               + wx_cs_params[CS_INCDIRS]),
261                              define_macros = wx_cs_params[CS_DEFS],                               define_macros = wx_cs_params[CS_DEFS],
262                              library_dirs = [proj4_libdir] +                               library_dirs = [proj4_libdir] +
263                                             wx_cs_params[CS_LIBDIRS],                               wx_cs_params[CS_LIBDIRS],
264                              libraries = [proj4_lib] + wx_cs_params[CS_LIBS]))                               libraries = [proj4_lib] + wx_cs_params[CS_LIBS])
265    extensions.append(wxproj_extension)
266    
267    
268  #  #
# Line 318  if os.path.isdir("Resources/Locale"): Line 320  if os.path.isdir("Resources/Locale"):
320          data_files.append(("Resources/Locale/" + d +"/LC_MESSAGES",          data_files.append(("Resources/Locale/" + d +"/LC_MESSAGES",
321                             ["Resources/Locale/"+ d +"/LC_MESSAGES/thuban.mo"]))                             ["Resources/Locale/"+ d +"/LC_MESSAGES/thuban.mo"]))
322    
323    #add the Lib content to the output
324    if os.path.isdir("Lib"):
325            for d in os.listdir("Lib"):
326                    data_files.append(("Lib", ["Lib/"+d]))
327    
328    
329  #  #
330  #       Command definitions  #       Command definitions
331  #  #
# Line 924  class bdist_inno(Command): Line 932  class bdist_inno(Command):
932          if self.output_basename is None:          if self.output_basename is None:
933              self.output_basename = "%s-%s-%d" \              self.output_basename = "%s-%s-%d" \
934                                     % (name, self.distribution.get_version(),                                     % (name, self.distribution.get_version(),
935                                        self.iss_revision)                                        int(self.iss_revision))
936    
937      def run(self, install_options = None):      def run(self, install_options = None):
938          """Execute the command. install_options if given, should be a          """Execute the command. install_options if given, should be a
939          directory of additional options to set in the install step"""          directory of additional options to set in the install step"""
940          # Obviously have to build before we can install          # Obviously have to build before we can install
941    
942            # add gdal to the build
943            for (dirpath, dnames, fnames) in os.walk('gdal'):                      
944                    files_in_dir = []
945                    dp = '/'.join(dirpath.split('\\'))
946                    for f in fnames:
947                            if os.path.isfile(os.path.join(dirpath,f)):                    
948                                    files_in_dir.append( dp + '/' + f)              
949                    if len(files_in_dir) > 0:
950                            data_files.append(( dp , files_in_dir))
951            # add thubaninit to the build
952    
953    
954          if not self.skip_build:          if not self.skip_build:
955              self.run_command('build')              self.run_command('build')
956    
# Line 1049  class thuban_bdist_inno(bdist_inno): Line 1069  class thuban_bdist_inno(bdist_inno):
1069              "warn_dir": 0,              "warn_dir": 0,
1070              "extra_files": ["COPYING", "Lib/proj.dll"],              "extra_files": ["COPYING", "Lib/proj.dll"],
1071              }              }
1072            install_options["extra_files"].extend(self.get_gdal_content())
1073    
1074          # don't make a symlink because we're simulating windows, so          # don't make a symlink because we're simulating windows, so
1075          # that we can generate the iss-file even on Linux          # that we can generate the iss-file even on Linux
1076          install_options["do_symlink"] = 0          install_options["do_symlink"] = 0
1077    
1078          bdist_inno.run(self, install_options)          bdist_inno.run(self, install_options)
1079    
1080        def get_gdal_content(self):
1081            '''
1082            Return the list of files in the gdal directory of the Thuban installation
1083            '''
1084            gdal_files = []
1085            for (dirpath, dnames, fnames) in os.walk('gdal'):                  
1086                if len(fnames) > 0:
1087                    for file in fnames :
1088                        gdal_files.append(dirpath + os.sep + file)
1089            return gdal_files
1090    
1091  class thuban_build_docs(Command):  class thuban_build_docs(Command):
1092    
1093      """Command to generate documentation from source code."""      """Command to generate documentation from source code."""
# Line 1072  class thuban_build_docs(Command): Line 1105  class thuban_build_docs(Command):
1105    
1106  class thuban_build_ext(build_ext):  class thuban_build_ext(build_ext):
1107    
1108      """Extend the build_ext command to optionally include the      """Extend the build_ext command with some Thuban specific options
1109      GDAL extension.  
1110        --with-gdal, --without-gdal
1111    
1112            Switch the optional GDAL support on/off.  Default is On.
1113    
1114        --use-wx-python-swig-hack
1115    
1116            For performance reasons, Thuban access wxPython objects at the
1117            C++ level so that it can directly call wxWidgets code from C++.
1118            The normal and preferred way to do that is to use the API
1119            defined in wxPython.h.  Unfortunately, this header file is not
1120            distributed with binary packages of wxPython on some platforms.
1121            By using the --use-wx-python-swig-hack option you can activate a
1122            way to access the C++ objects without wxPython.h.  This relies
1123            on internals of SWIG, so it might change with future wxPython
1124            versions.  Therefore, only use this option if the normal way
1125            doesn't work for you.
1126      """      """
1127    
1128      user_options = build_ext.user_options[:]      user_options = build_ext.user_options[:]
1129      user_options.extend([("with-gdal", None, "Include GDAL support."),      user_options.extend([("with-gdal", None, "Include GDAL support."),
1130                           ("without-gdal", None, "Don't include GDAL support.")])                           ("without-gdal", None, "Don't include GDAL support."),
1131                             ("use-wx-python-swig-hack", None,
1132                     "Use a hack to access wxPython objects at the C++ level"
1133                     "(use only when you absolutely can't use wxPython.h)")])
1134    
1135      boolean_options = ["with-gdal"]      boolean_options = ["with-gdal", "use-wx-python-swig-hack"]
1136      negative_opt = {'without-gdal' : 'with-gdal'}      negative_opt = {'without-gdal' : 'with-gdal'}
1137    
1138      def initialize_options(self):      def initialize_options(self):
1139          self.with_gdal = True          self.with_gdal = True
1140            self.use_wx_python_swig_hack = False
1141          build_ext.initialize_options(self)          build_ext.initialize_options(self)
1142    
1143      def finalize_options(self):      def finalize_options(self):
1144          build_ext.finalize_options(self)          build_ext.finalize_options(self)
1145          if self.with_gdal and include_gdal:          if self.with_gdal and include_gdal:
1146              self.extensions.append(Extension("Lib.gdalwarp",              self.extensions.append(Extension("Lib.gdalwarp",
1147                                  [ext_dir + "/thuban/gdalwarp.cpp",                                  [ext_dir + "/thuban/gdalwarp.cpp"],
                                 ext_dir + "/thuban/cpl_mfile.cpp",  
                                 ext_dir + "/thuban/bmpdataset.cpp"],  
1148                                  include_dirs = gdal_cs_params[CS_INCDIRS] +                                  include_dirs = gdal_cs_params[CS_INCDIRS] +
1149                                                 [ext_dir + "/thuban/"],                                                 [ext_dir + "/thuban/"],
1150                                  define_macros = gdal_cs_params[CS_DEFS],                                  define_macros = gdal_cs_params[CS_DEFS],
1151                                  library_dirs = gdal_cs_params[CS_LIBDIRS],                                  library_dirs = gdal_cs_params[CS_LIBDIRS],
1152                                  libraries = gdal_cs_params[CS_LIBS]))                                  libraries = gdal_cs_params[CS_LIBS]))
1153            if self.use_wx_python_swig_hack:
1154                wxproj_extension.define_macros.append(("USE_WX_PYTHON_SWIG_HACK",
1155                                                       None))
1156    
1157      def run(self, install_options = None):      def run(self, install_options = None):
1158          build_ext.run(self)          build_ext.run(self)
# Line 1112  Thuban is a viewer for geographic data w Line 1166  Thuban is a viewer for geographic data w
1166  """  """
1167    
1168  setup(name = "Thuban",  setup(name = "Thuban",
1169        version = "1.0.0",        version = "1.1.0",
1170        description = "Geographic data viewer",        description = "Geographic data viewer",
1171        long_description = long_description,        long_description = long_description,
1172        license = "GPL",        license = "GPL",
# Line 1123  setup(name = "Thuban", Line 1177  setup(name = "Thuban",
1177        scripts = ["thuban.py"],        scripts = ["thuban.py"],
1178        packages = ["Thuban", "Thuban.Lib", "Thuban.Model", "Thuban.UI",        packages = ["Thuban", "Thuban.Lib", "Thuban.Model", "Thuban.UI",
1179                    "Extensions", "Extensions.gns2shp", "Extensions.wms",                    "Extensions", "Extensions.gns2shp", "Extensions.wms",
1180                    "Extensions.importAPR", "Extensions.profiling"],                    "Extensions.importAPR", "Extensions.profiling",
1181                              "Extensions.svgexport", "Extensions.mouseposition",
1182                              "Extensions.bboxdump", "Extensions.ogr",
1183                      "Extensions.umn_mapserver"],
1184        ext_modules = extensions,        ext_modules = extensions,
1185        py_modules = py_modules,        py_modules = py_modules,
1186        data_files = data_files,        data_files = data_files,
# Line 1137  setup(name = "Thuban", Line 1194  setup(name = "Thuban",
1194                    "install_lib": "$base/lib/thuban",                    "install_lib": "$base/lib/thuban",
1195                    "install_scripts": "$base/lib/thuban",                    "install_scripts": "$base/lib/thuban",
1196                    "install_data": "$base/lib/thuban",                    "install_data": "$base/lib/thuban",
   
1197                    # Don't print warning messages about the lib dir not                    # Don't print warning messages about the lib dir not
1198                    # being on Python's path. The libraries are Thuban                    # being on Python's path. The libraries are Thuban
1199                    # specific and are installed just for Thuban. They'll                    # specific and are installed just for Thuban. They'll

Legend:
Removed from v.2478  
changed lines
  Added in v.2711

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26