/[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 212 by bh, Wed Jul 10 14:06:09 2002 UTC revision 543 by jonathan, Thu Mar 20 09:43:29 2003 UTC
# Line 1  Line 1 
1  # Copyright (c) 2001, 2002 by Intevation GmbH  # Copyright (c) 2001, 2002, 2003 by Intevation GmbH
2  # Authors:  # Authors:
3  # Bernhard Herzog <[email protected]>  # Bernhard Herzog <[email protected]>
4  #  #
# Line 80  elif os.name == "nt": Line 80  elif os.name == "nt":
80      proj4_lib = "proj_i"      proj4_lib = "proj_i"
81    
82      # Define include and lib directories for wxWindows and      # Define include and lib directories for wxWindows and
83      wx_prefix = r"D:\wx230"      wx_prefix = r"D:\wx240"
84      wx_inc =  os.path.join(wx_prefix, "include")      wx_inc = [os.path.join(wx_prefix, 'lib', 'mswdllh'),
85      wx_lib =  os.path.join(wx_prefix, "lib")                os.path.join(wx_prefix, "include")]
86        wx_lib = [os.path.join(wx_prefix, "lib")]
87    
88    
89      #      #
90      # Unless you use a wxPython version other than 2.3.1, you probably      # Unless you use a wxPython version other than 2.4.0, you probably
91      # shouldn't have to modify anything below here      # shouldn't have to modify anything below here
92      ##################################################################      ##################################################################
93            
# Line 127  elif os.name == "nt": Line 129  elif os.name == "nt":
129                  ('WXP_USE_THREAD', '1'),                  ('WXP_USE_THREAD', '1'),
130                  ]                  ]
131            
132      wx_incdirs = [wx_inc]      wx_incdirs = wx_inc
133      wx_libdirs = [wx_lib]      wx_libdirs = wx_lib
134      wx_libs = ["wx23_1h"]      wx_libs = ["wxmsw24h"]
135    
136      wx_libs = wx_libs + ['kernel32', 'user32', 'gdi32', 'comdlg32',      wx_libs = wx_libs + ['kernel32', 'user32', 'gdi32', 'comdlg32',
137                           'winspool', 'winmm', 'shell32', 'oldnames',                           'winspool', 'winmm', 'shell32', 'oldnames',
138                           'comctl32', 'ctl3d32', 'odbc32', 'ole32', 'oleaut32',                           'comctl32', 'ctl3d32', 'odbc32', 'ole32', 'oleaut32',
# Line 417  class InstallLocal(Command): Line 420  class InstallLocal(Command):
420    
421      user_options = [      user_options = [
422          ('skip-build', None, "skip the build steps"),          ('skip-build', None, "skip the build steps"),
423            ('create-init-module', None,
424             "Create the thubaninit.py module to ease use of Thuban as a library"),
425            ('dont-create-init-module', None,
426             "Do not create the thubaninit.py module"),
427          ]          ]
428    
429        boolean_options = ["create-init-module"]
430        negative_opt = {'dont-create-init-module' : 'create-init-module'}
431    
432    
433      def initialize_options (self):      def initialize_options (self):
434          self.extensions = None          self.extensions = None
435          self.build_dir = None          self.build_dir = None
436          self.skip_build = None          self.skip_build = None
437            self.create_init_module = None
438    
439      def finalize_options (self):      def finalize_options (self):
440          self.set_undefined_options("install",          self.set_undefined_options("install",
441                                     ("build_lib", "build_dir"),                                     ("build_lib", "build_dir"),
442                                     ('skip_build', 'skip_build'))                                     ('skip_build', 'skip_build'))
443          self.extensions = self.distribution.ext_modules          self.extensions = self.distribution.ext_modules
444            if self.create_init_module is None:
445                # by default we create the init module
446                self.create_init_module = 1
447    
448      def run(self):      def run(self):
449          # Make sure we have built everything we need first          # Make sure we have built everything we need first
# Line 442  class InstallLocal(Command): Line 457  class InstallLocal(Command):
457          else:          else:
458              self.copy_tree(libdir, "Lib")              self.copy_tree(libdir, "Lib")
459    
460            # create the init module if desired
461            if self.create_init_module:
462                # create the init module
463                initfilename = "thubaninit.py"
464                contents = thubaninit_contents("")
465                self.execute(write_file, (initfilename, contents),
466                             "Create %s" % initfilename)
467    
468      def link_dir(self, src, dest):      def link_dir(self, src, dest):
469          """Create a symbolic link dest pointing to src"""          """Create a symbolic link dest pointing to src"""
470          if self.verbose:          if self.verbose:
# Line 468  class thuban_build_py(build_py): Line 491  class thuban_build_py(build_py):
491      distribution.      distribution.
492      """      """
493    
494        # FIXME: When Thuban can rely on Python 2.3 as the oldest supported
495        # Python release we don't need to override the run and
496        # find_all_modules methods anymore. distutils will allow both python
497        # modules and packages starting with 2.3.
498    
499      def run(self):      def run(self):
500          """The same the as the original in build_py revision 1.33 except          """The same the as the original in build_py revision 1.33 except
501          that this allows both packages and modules to be in one          that this allows both packages and modules to be in one
# Line 519  class thuban_build_py(build_py): Line 547  class thuban_build_py(build_py):
547          return modules          return modules
548    
549    
550  thubaninit_contents = """  thubaninit_contents_start = """
551  # This module was automatically generated by Thuban's install script  # This module was automatically generated by Thuban's install script
552  '''Import this module once per program (best place is probably the file  '''Import this module once per program (best place is probably the file
553  that ends up as your __main__ module) to be able to import Thuban  that ends up as your __main__ module) to be able to import Thuban
# Line 531  import thubaninit Line 559  import thubaninit
559  import Thuban  import Thuban
560  '''  '''
561  import sys, os  import sys, os
562  sys.path.insert(0, %(thubandir)s)  """
563    
564    thubaninit_contents_thubaninitdir = """
565    sys.path.insert(0, %(thubandir)s)
566    """
567    thubaninit_contents_otherdirs = """
568  # Put the Lib dir into the path. The Lib dir contains some extra Python  # Put the Lib dir into the path. The Lib dir contains some extra Python
569  # modules  # modules
570  import Thuban  import Thuban
# Line 542  if os.path.isdir(dir): Line 574  if os.path.isdir(dir):
574      sys.path.insert(0, dir)      sys.path.insert(0, dir)
575  """  """
576    
577    def thubaninit_contents(thubandir):
578        """Return the contents of the the thubaninit file as a list of lines.
579    
580        The parameter thubandir is the parent directory where the Thuban/
581        package or the empty string if the thubaninit file itself will be
582        located in that direcory as well.
583        """
584        contents = thubaninit_contents_start
585        if thubandir:
586            thubandir = repr(thubandir)
587            contents += thubaninit_contents_thubaninitdir % locals()
588        contents += thubaninit_contents_otherdirs
589        return contents.split("\n")
590    
591    
592  class ThubanInstall(install):  class ThubanInstall(install):
593    
# Line 569  class ThubanInstall(install): Line 615  class ThubanInstall(install):
615                           ("init-module-dir=", None,                           ("init-module-dir=", None,
616                            "Directory in which to create the init module."                            "Directory in which to create the init module."
617                            " Defaults to Python's site-packages directory."),                            " Defaults to Python's site-packages directory."),
                           
618                           ])                           ])
619    
620      boolean_options = install.boolean_options[:]      boolean_options = install.boolean_options[:]
# Line 634  class ThubanInstall(install): Line 679  class ThubanInstall(install):
679                  src, dest = item                  src, dest = item
680              else:              else:
681                  src = dest = item                  src = dest = item
682              self.copy_file(convert_path(src),              self.copy_file(convert_path(src),
683                             os.path.join(self.root, convert_path(dest)))                             os.path.join(self.root, convert_path(dest)))
684    
685          if os.name == "posix" and self.do_symlink:          if os.name == "posix" and self.do_symlink:
# Line 654  class ThubanInstall(install): Line 699  class ThubanInstall(install):
699              initfilename = self.thuban_init_filename()              initfilename = self.thuban_init_filename()
700              if self.root:              if self.root:
701                  initfilename = change_root(self.root, initfilename)                  initfilename = change_root(self.root, initfilename)
702              contents = thubaninit_contents % {              contents = thubaninit_contents(self.install_lib_orig)
                 "thubandir": repr(self.install_lib_orig)  
                 }  
703              self.mkpath(os.path.dirname(initfilename))              self.mkpath(os.path.dirname(initfilename))
704              self.execute(write_file, (initfilename, split(contents, "\n")),              self.execute(write_file, (initfilename, contents),
705                           "Create %s" % initfilename)                           "Create %s" % initfilename)
706    
707      def link_file(self, src, dest):      def link_file(self, src, dest):
# Line 718  bdist_rpm_install_script = ''' Line 761  bdist_rpm_install_script = '''
761     --prefix=%(prefix)s     --prefix=%(prefix)s
762  '''  '''
763    
764        
765  class thuban_bdist_rpm(bdist_rpm):  class thuban_bdist_rpm(bdist_rpm):
766    
767      """Thuban specific RPM distribution command"""      """Thuban specific RPM distribution command"""
# Line 830  class bdist_inno(Command): Line 873  class bdist_inno(Command):
873          """Execute the command. install_options if given, should be a          """Execute the command. install_options if given, should be a
874          directory of additional options to set in the install step"""          directory of additional options to set in the install step"""
875          # Obviously have to build before we can install          # Obviously have to build before we can install
876    
877          if not self.skip_build:          if not self.skip_build:
878              self.run_command('build')              self.run_command('build')
879    
# Line 852  class bdist_inno(Command): Line 896  class bdist_inno(Command):
896          self.execute(write_file, (iss_file, self.generate_iss()),          self.execute(write_file, (iss_file, self.generate_iss()),
897                       "Create Inno Setup script file %s" % iss_file)                       "Create Inno Setup script file %s" % iss_file)
898    
899          # and invoke          # and invoke
900          if self.run_inno:          if self.run_inno:
901              self.spawn(["iscc", iss_file])              self.spawn(["iscc", iss_file])
902    
# Line 918  class bdist_inno(Command): Line 962  class bdist_inno(Command):
962              line = 'Name: "{group}\\%s"; Filename: "%s";' \              line = 'Name: "{group}\\%s"; Filename: "%s";' \
963                     % (icon.title, icon.install_name)                     % (icon.title, icon.install_name)
964              iss.append(line)              iss.append(line)
965                
966          return iss          return iss
967    
968    
# Line 934  class InnoIconItem: Line 978  class InnoIconItem:
978          else:          else:
979              self.install_name = filename              self.install_name = filename
980    
981                
982  class thuban_bdist_inno(bdist_inno):  class thuban_bdist_inno(bdist_inno):
983    
984      """Thuban specific Inno Setup stuff"""      """Thuban specific Inno Setup stuff"""
# Line 942  class thuban_bdist_inno(bdist_inno): Line 986  class thuban_bdist_inno(bdist_inno):
986      def run(self):      def run(self):
987          install_options = {          install_options = {
988              "prefix": ".",              "prefix": ".",
989                "install_lib": "$base",
990                "install_data": "$base",
991              "install_scripts": "$base",              "install_scripts": "$base",
992              "warn_dir": 0,              "warn_dir": 0,
993              "extra_files": ["COPYING", "Lib/proj.dll"],              "extra_files": ["COPYING", "Lib/proj.dll"],
# Line 949  class thuban_bdist_inno(bdist_inno): Line 995  class thuban_bdist_inno(bdist_inno):
995          # don't make a symlink because we're simulating windows, so          # don't make a symlink because we're simulating windows, so
996          # that we can generate the iss-file even on Linux          # that we can generate the iss-file even on Linux
997          install_options["do_symlink"] = 0          install_options["do_symlink"] = 0
998    
999          bdist_inno.run(self, install_options)          bdist_inno.run(self, install_options)
1000        
1001                class thuban_build_docs(Command):
1002    
1003        """Command to generate documentation from source code."""
1004    
1005        description = "Generate documentation."
1006    
1007        user_options = []
1008    
1009        def initialize_options(self): pass
1010    
1011        def finalize_options(self): pass
1012    
1013        def run(self, install_options = None):
1014            self.spawn(["happydoc", "-d./Doc", "./Thuban"])
1015    
1016  #  #
1017  #   Run the script  #   Run the script
1018  #  #
# Line 962  Thuban is a viewer for geographic data w Line 1023  Thuban is a viewer for geographic data w
1023  """  """
1024    
1025  setup(name = "Thuban",  setup(name = "Thuban",
1026        version = "0.1.3cvs",        version = "0.2.0",
1027        description = "Geographic data viewer",        description = "Geographic data viewer",
1028        long_description = long_description,        long_description = long_description,
1029        licence = "GPL",        licence = "GPL",
# Line 1004  setup(name = "Thuban", Line 1065  setup(name = "Thuban",
1065                    "install": ThubanInstall,                    "install": ThubanInstall,
1066                    "bdist_rpm": thuban_bdist_rpm,                    "bdist_rpm": thuban_bdist_rpm,
1067                    "bdist_inno": thuban_bdist_inno,                    "bdist_inno": thuban_bdist_inno,
1068                    "data_dist": data_dist                    "data_dist": data_dist,
1069                      "build_docs": thuban_build_docs
1070                    })                    })
1071    
1072    

Legend:
Removed from v.212  
changed lines
  Added in v.543

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26