src/ldt/setup.py
changeset 629 04c71ec19b80
parent 627 f5c55582565d
child 632 e85856bfd59b
equal deleted inserted replaced
628:1f4fd6aed2d0 629:04c71ec19b80
     2 from distutils.core import setup
     2 from distutils.core import setup
     3 from distutils.command.install_data import install_data
     3 from distutils.command.install_data import install_data
     4 from distutils.command.install import INSTALL_SCHEMES
     4 from distutils.command.install import INSTALL_SCHEMES
     5 import sys
     5 import sys
     6 
     6 
       
     7 print("hello 1")
     7 
     8 
     8 class osx_install_data(install_data):
     9 class osx_install_data(install_data):
     9     # On MacOS, the platform-specific lib dir is /System/Library/Framework/Python/.../
    10     # On MacOS, the platform-specific lib dir is /System/Library/Framework/Python/.../
    10     # which is wrong. Python 2.5 supplied with MacOS 10.5 has an Apple-specific fix
    11     # which is wrong. Python 2.5 supplied with MacOS 10.5 has an Apple-specific fix
    11     # for this in distutils.command.install_data#306. It fixes install_lib but not
    12     # for this in distutils.command.install_data#306. It fixes install_lib but not
    15         # By the time finalize_options is called, install.install_lib is set to the
    16         # By the time finalize_options is called, install.install_lib is set to the
    16         # fixed directory, so we set the installdir to install_lib. The
    17         # fixed directory, so we set the installdir to install_lib. The
    17         # install_data class uses ('install_data', 'install_dir') instead.
    18         # install_data class uses ('install_data', 'install_dir') instead.
    18         self.set_undefined_options('install', ('install_lib', 'install_dir'))
    19         self.set_undefined_options('install', ('install_lib', 'install_dir'))
    19         install_data.finalize_options(self)
    20         install_data.finalize_options(self)
       
    21 print("hello 2")
    20 
    22 
    21 def fullsplit(path, result=None):
    23 def fullsplit(path, result=None):
    22     """
    24     """
    23     Split a pathname into components (the opposite of os.path.join) in a
    25     Split a pathname into components (the opposite of os.path.join) in a
    24     platform-neutral way.
    26     platform-neutral way.
    30         return [tail] + result
    32         return [tail] + result
    31     if head == path:
    33     if head == path:
    32         return result
    34         return result
    33     return fullsplit(head, [tail] + result)
    35     return fullsplit(head, [tail] + result)
    34 
    36 
    35 
    37 print("hello 3")
    36 def launch_setup(script_name, script_args):
    38 def launch_setup(script_name, script_args):
    37     if sys.platform == "darwin": 
    39     if sys.platform == "darwin": 
    38         cmdclasses = {'install_data': osx_install_data} 
    40         cmdclasses = {'install_data': osx_install_data} 
    39     else: 
    41     else: 
    40         cmdclasses = {'install_data': install_data} 
    42         cmdclasses = {'install_data': install_data} 
   116         ],
   118         ],
   117     )
   119     )
   118 
   120 
   119 
   121 
   120 if __name__ == "__main__":
   122 if __name__ == "__main__":
   121     
   123    
       
   124     print("hello 4")    
   122     script_name = os.path.basename(sys.argv[0])
   125     script_name = os.path.basename(sys.argv[0])
   123     script_args = sys.argv[1:]
   126     script_args = sys.argv[1:]
   124     
   127     print("hello 5")
   125     launch_setup(script_name, script_args)
   128     launch_setup(script_name, script_args)
       
   129     print("hello 6")