/[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 19 by bh, Tue Sep 4 15:11:27 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 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.19

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26