/[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 452 by bh, Tue Mar 4 11:31:04 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 417  class InstallLocal(Command): Line 417  class InstallLocal(Command):
417    
418      user_options = [      user_options = [
419          ('skip-build', None, "skip the build steps"),          ('skip-build', None, "skip the build steps"),
420            ('create-init-module', None,
421             "Create the thubaninit.py module to ease use of Thuban as a library"),
422            ('dont-create-init-module', None,
423             "Do not create the thubaninit.py module"),
424          ]          ]
425    
426        boolean_options = ["create-init-module"]
427        negative_opt = {'dont-create-init-module' : 'create-init-module'}
428    
429    
430      def initialize_options (self):      def initialize_options (self):
431          self.extensions = None          self.extensions = None
432          self.build_dir = None          self.build_dir = None
433          self.skip_build = None          self.skip_build = None
434            self.create_init_module = None
435    
436      def finalize_options (self):      def finalize_options (self):
437          self.set_undefined_options("install",          self.set_undefined_options("install",
438                                     ("build_lib", "build_dir"),                                     ("build_lib", "build_dir"),
439                                     ('skip_build', 'skip_build'))                                     ('skip_build', 'skip_build'))
440          self.extensions = self.distribution.ext_modules          self.extensions = self.distribution.ext_modules
441            if self.create_init_module is None:
442                # by default we create the init module
443                self.create_init_module = 1
444    
445      def run(self):      def run(self):
446          # Make sure we have built everything we need first          # Make sure we have built everything we need first
# Line 442  class InstallLocal(Command): Line 454  class InstallLocal(Command):
454          else:          else:
455              self.copy_tree(libdir, "Lib")              self.copy_tree(libdir, "Lib")
456    
457            # create the init module if desired
458            if self.create_init_module:
459                # create the init module
460                initfilename = "thubaninit.py"
461                contents = thubaninit_contents("")
462                self.execute(write_file, (initfilename, contents),
463                             "Create %s" % initfilename)
464    
465      def link_dir(self, src, dest):      def link_dir(self, src, dest):
466          """Create a symbolic link dest pointing to src"""          """Create a symbolic link dest pointing to src"""
467          if self.verbose:          if self.verbose:
# Line 468  class thuban_build_py(build_py): Line 488  class thuban_build_py(build_py):
488      distribution.      distribution.
489      """      """
490    
491        # FIXME: When Thuban can rely on Python 2.3 as the oldest supported
492        # Python release we don't need to override the run and
493        # find_all_modules methods anymore. distutils will allow both python
494        # modules and packages starting with 2.3.
495    
496      def run(self):      def run(self):
497          """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
498          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 544  class thuban_build_py(build_py):
544          return modules          return modules
545    
546    
547  thubaninit_contents = """  thubaninit_contents_start = """
548  # This module was automatically generated by Thuban's install script  # This module was automatically generated by Thuban's install script
549  '''Import this module once per program (best place is probably the file  '''Import this module once per program (best place is probably the file
550  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 556  import thubaninit
556  import Thuban  import Thuban
557  '''  '''
558  import sys, os  import sys, os
559  sys.path.insert(0, %(thubandir)s)  """
560    
561    thubaninit_contents_thubaninitdir = """
562    sys.path.insert(0, %(thubandir)s)
563    """
564    thubaninit_contents_otherdirs = """
565  # 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
566  # modules  # modules
567  import Thuban  import Thuban
# Line 542  if os.path.isdir(dir): Line 571  if os.path.isdir(dir):
571      sys.path.insert(0, dir)      sys.path.insert(0, dir)
572  """  """
573    
574    def thubaninit_contents(thubandir):
575        """Return the contents of the the thubaninit file as a list of lines.
576    
577        The parameter thubandir is the parent directory where the Thuban/
578        package or the empty string if the thubaninit file itself will be
579        located in that direcory as well.
580        """
581        contents = thubaninit_contents_start
582        if thubandir:
583            thubandir = repr(thubandir)
584            contents += thubaninit_contents_thubaninitdir % locals()
585        contents += thubaninit_contents_otherdirs
586        return contents.split("\n")
587    
588    
589  class ThubanInstall(install):  class ThubanInstall(install):
590    
# Line 569  class ThubanInstall(install): Line 612  class ThubanInstall(install):
612                           ("init-module-dir=", None,                           ("init-module-dir=", None,
613                            "Directory in which to create the init module."                            "Directory in which to create the init module."
614                            " Defaults to Python's site-packages directory."),                            " Defaults to Python's site-packages directory."),
                           
615                           ])                           ])
616    
617      boolean_options = install.boolean_options[:]      boolean_options = install.boolean_options[:]
# Line 634  class ThubanInstall(install): Line 676  class ThubanInstall(install):
676                  src, dest = item                  src, dest = item
677              else:              else:
678                  src = dest = item                  src = dest = item
679              self.copy_file(convert_path(src),              self.copy_file(convert_path(src),
680                             os.path.join(self.root, convert_path(dest)))                             os.path.join(self.root, convert_path(dest)))
681    
682          if os.name == "posix" and self.do_symlink:          if os.name == "posix" and self.do_symlink:
# Line 654  class ThubanInstall(install): Line 696  class ThubanInstall(install):
696              initfilename = self.thuban_init_filename()              initfilename = self.thuban_init_filename()
697              if self.root:              if self.root:
698                  initfilename = change_root(self.root, initfilename)                  initfilename = change_root(self.root, initfilename)
699              contents = thubaninit_contents % {              contents = thubaninit_contents(self.install_lib_orig)
                 "thubandir": repr(self.install_lib_orig)  
                 }  
700              self.mkpath(os.path.dirname(initfilename))              self.mkpath(os.path.dirname(initfilename))
701              self.execute(write_file, (initfilename, split(contents, "\n")),              self.execute(write_file, (initfilename, contents),
702                           "Create %s" % initfilename)                           "Create %s" % initfilename)
703    
704      def link_file(self, src, dest):      def link_file(self, src, dest):
# Line 718  bdist_rpm_install_script = ''' Line 758  bdist_rpm_install_script = '''
758     --prefix=%(prefix)s     --prefix=%(prefix)s
759  '''  '''
760    
761        
762  class thuban_bdist_rpm(bdist_rpm):  class thuban_bdist_rpm(bdist_rpm):
763    
764      """Thuban specific RPM distribution command"""      """Thuban specific RPM distribution command"""
# Line 852  class bdist_inno(Command): Line 892  class bdist_inno(Command):
892          self.execute(write_file, (iss_file, self.generate_iss()),          self.execute(write_file, (iss_file, self.generate_iss()),
893                       "Create Inno Setup script file %s" % iss_file)                       "Create Inno Setup script file %s" % iss_file)
894    
895          # and invoke          # and invoke
896          if self.run_inno:          if self.run_inno:
897              self.spawn(["iscc", iss_file])              self.spawn(["iscc", iss_file])
898    
# Line 918  class bdist_inno(Command): Line 958  class bdist_inno(Command):
958              line = 'Name: "{group}\\%s"; Filename: "%s";' \              line = 'Name: "{group}\\%s"; Filename: "%s";' \
959                     % (icon.title, icon.install_name)                     % (icon.title, icon.install_name)
960              iss.append(line)              iss.append(line)
961                
962          return iss          return iss
963    
964    
# Line 934  class InnoIconItem: Line 974  class InnoIconItem:
974          else:          else:
975              self.install_name = filename              self.install_name = filename
976    
977                
978  class thuban_bdist_inno(bdist_inno):  class thuban_bdist_inno(bdist_inno):
979    
980      """Thuban specific Inno Setup stuff"""      """Thuban specific Inno Setup stuff"""
# Line 950  class thuban_bdist_inno(bdist_inno): Line 990  class thuban_bdist_inno(bdist_inno):
990          # that we can generate the iss-file even on Linux          # that we can generate the iss-file even on Linux
991          install_options["do_symlink"] = 0          install_options["do_symlink"] = 0
992          bdist_inno.run(self, install_options)          bdist_inno.run(self, install_options)
993        
994                
995  #  #
996  #   Run the script  #   Run the script
997  #  #
# Line 962  Thuban is a viewer for geographic data w Line 1002  Thuban is a viewer for geographic data w
1002  """  """
1003    
1004  setup(name = "Thuban",  setup(name = "Thuban",
1005        version = "0.1.3cvs",        version = "0.1.3",
1006        description = "Geographic data viewer",        description = "Geographic data viewer",
1007        long_description = long_description,        long_description = long_description,
1008        licence = "GPL",        licence = "GPL",

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

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26