/[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 18 by bh, Mon Sep 3 16:25:09 2001 UTC revision 54 by bh, Tue Sep 11 11:45:09 2001 UTC
# Line 20  from types import TupleType Line 20  from types import TupleType
20  from distutils.core import setup, Extension, Command  from distutils.core import setup, Extension, Command
21  from distutils.command.install import install  from distutils.command.install import install
22  from distutils.command.build_py import build_py  from distutils.command.build_py import build_py
23    from distutils.command.bdist_rpm import bdist_rpm
24  from distutils.file_util import write_file  from distutils.file_util import write_file
25  from distutils.util import convert_path, change_root  from distutils.util import convert_path, change_root
26    
# Line 50  if os.name == "posix": Line 51  if os.name == "posix":
51    
52      # On POSIX-systems we run wxgtk-config to determine the C++-compiler      # On POSIX-systems we run wxgtk-config to determine the C++-compiler
53      # flags      # flags
54      wx_config_script = "wxgtk-config"      wx_config_script = "wx-config"
55      # These lists will be filled automatically below      # These lists will be filled automatically below
56      wx_defs = []      wx_defs = []
57      wx_incdirs = []      wx_incdirs = []
# Line 142  def run_script(cmdline): Line 143  def run_script(cmdline):
143    
144    
145  def run_wx_script(command):  def run_wx_script(command):
146      # first, determine the C++ preprocessor flags      # first, determine the C++ preprocessor flags Use --cflags here
147      flags = run_script(command + ' --cxxflags ')      # because it seems that older version don't have --cxxflags and
148        # newer ones return the same result for both
149        flags = run_script(command + ' --cflags ')
150      if flags is None:      if flags is None:
151          return 0          return 0
152      for flag in split(flags):      for flag in split(flags):
# Line 413  class ThubanInstall(install): Line 416  class ThubanInstall(install):
416                             os.path.join(self.root, convert_path(dest)))                             os.path.join(self.root, convert_path(dest)))
417    
418          if os.name == "posix" and self.do_symlink:          if os.name == "posix" and self.do_symlink:
419              scriptfile = os.path.join(self.install_scripts, "thuban.py")              install_scripts = self.install_scripts
420                if self.root:
421                    install_scripts = install_scripts[len(self.root):]
422                scriptfile = os.path.join(install_scripts, "thuban.py")
423              bindir = os.path.join(self.prefix, "bin")              bindir = os.path.join(self.prefix, "bin")
424              if self.root:              if self.root:
425                  bindir = change_root(self.root, bindir)                  bindir = change_root(self.root, bindir)
426              binfile = os.path.join(bindir, "thuban")              binfile = os.path.join(bindir, "thuban")
427              self.mkpath(bindir)              self.mkpath(bindir)
428              self.copy_file(scriptfile, binfile, link="sym")              self.link_file(scriptfile, binfile)
429    
430        def link_file(self, src, dest):
431            """Create a symbolic link dest pointing to src.
432    
433            Unlike the symlink variant of the command object's copy_file
434            method, this method even performs the link if src doesn't exist.
435            This is useful when installing with an alternat root directory"""
436            if self.verbose:
437                self.announce("symlinking %s -> %s" % (src, dest))
438            if self.dry_run:
439                return
440    
441            if not os.path.exists(dest):
442                os.symlink(src, dest)
443    
444    
445      def get_outputs (self):      def get_outputs (self):
446          outputs = install.get_outputs(self)          outputs = install.get_outputs(self)
# Line 429  class ThubanInstall(install): Line 450  class ThubanInstall(install):
450              else:              else:
451                  src = dest = item                  src = dest = item
452              outputs.append(os.path.join(self.root, convert_path(dest)))              outputs.append(os.path.join(self.root, convert_path(dest)))
453            if os.name == "posix" and self.do_symlink:
454                bindir = os.path.join(self.prefix, "bin")
455                if self.root:
456                    bindir = change_root(self.root, bindir)
457                binfile = os.path.join(bindir, "thuban")
458                outputs.append(binfile)
459          return outputs          return outputs
460    
461    
462    bdist_rpm_prep_script = '''
463    %setup
464    cp extensions/pyshapelib/{README,README.pyshapelib}
465    cp extensions/pyshapelib/{COPYING,COPYING.pyshapelib}
466    cp extensions/pyprojection/{LICENSE,LICENSE.pyprojection}
467    '''
468    
469    
470        
471    class thuban_bdist_rpm(bdist_rpm):
472    
473        """Thuban specific RPM distribution command"""
474    
475        def run(self):
476            # create the prep script for the spec-file
477            open("bdist_rpm_prep", "w").write(bdist_rpm_prep_script)
478    
479            bdist_rpm.run(self)
480    
481    
482  class bdist_inno(Command):  class bdist_inno(Command):
483    
484      """Command to create a windows installer with Inno Setup"""      """Command to create a windows installer with Inno Setup"""
# Line 522  class bdist_inno(Command): Line 570  class bdist_inno(Command):
570          if os.name != 'nt':          if os.name != 'nt':
571              # Must force install to use the 'nt' scheme;              # Must force install to use the 'nt' scheme;
572              install.select_scheme('nt')              install.select_scheme('nt')
             # don't make a symlink because we're simulating windows, so  
             # that we can generate the iss-file even on Linux  
             install.do_symlink = 0  
573    
574          self.announce("installing to %s" % self.bdist_dir)          self.announce("installing to %s" % self.bdist_dir)
575          install.ensure_finalized()          install.ensure_finalized()
# Line 607  class bdist_inno(Command): Line 652  class bdist_inno(Command):
652    
653  class InnoIconItem:  class InnoIconItem:
654    
655      """Describe one item for he start menu for the Inno Setup installer"""      """Describe one item for the start menu for the Inno Setup installer"""
656    
657      def __init__(self, filename, title, install_name = None):      def __init__(self, filename, title, install_name = None):
658          self.filename = filename          self.filename = filename
# Line 617  class InnoIconItem: Line 662  class InnoIconItem:
662          else:          else:
663              self.install_name = filename              self.install_name = filename
664    
665                
666  class thuban_bdist_inno(bdist_inno):  class thuban_bdist_inno(bdist_inno):
667    
668      """Thuban specific Inno Setup stuff"""      """Thuban specific Inno Setup stuff"""
# Line 629  class thuban_bdist_inno(bdist_inno): Line 674  class thuban_bdist_inno(bdist_inno):
674              "warn_dir": 0,              "warn_dir": 0,
675              "extra_files": ["COPYING", "Lib/proj.dll"],              "extra_files": ["COPYING", "Lib/proj.dll"],
676              }              }
677            # don't make a symlink because we're simulating windows, so
678            # that we can generate the iss-file even on Linux
679            install_options["do_symlink"] = 0
680          bdist_inno.run(self, install_options)          bdist_inno.run(self, install_options)
681            
682                            
# Line 682  setup(name = "Thuban", Line 730  setup(name = "Thuban",
730        cmdclass = {"build_py": thuban_build_py,        cmdclass = {"build_py": thuban_build_py,
731                    "install_local": InstallLocal,                    "install_local": InstallLocal,
732                    "install": ThubanInstall,                    "install": ThubanInstall,
733                      "bdist_rpm": thuban_bdist_rpm,
734                    "bdist_inno": thuban_bdist_inno                    "bdist_inno": thuban_bdist_inno
735                    })                    })
736    

Legend:
Removed from v.18  
changed lines
  Added in v.54

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26