Changeset 7928:478ad7720331 in orange


Ignore:
Timestamp:
05/23/11 11:54:19 (3 years ago)
Author:
ales_erjavec <ales.erjavec@…>
Branch:
default
Convert:
66e69df2bf82c720bbae34421ea6aea78ff8d7b0
Message:

Fixed 'install –force' (failed to overwrite the liborange.so -> orange.so symlink, ticket #751)
Fixed build_ext –inplace (failed to find liborange_include)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orange/setup.py

    r7630 r7928  
    7575    def finalize_options(self): 
    7676        build_ext.finalize_options(self) 
    77         self.library_dirs.append(self.build_lib) # add the build lib dir (for liborange_include) 
     77        # add the build_lib dir (for liborange_include) 
     78        if not self.inplace: 
     79            self.library_dirs.append(self.build_lib)  
     80        else: 
     81            self.library_dirs.append("./")  
    7882         
    7983    def build_extension(self, ext): 
     
    9094            ext_path, ext_filename = os.path.split(ext_path) 
    9195            realpath = os.path.realpath(os.curdir) 
    92 #            print realpath, ext_path 
    9396            try: 
    9497                os.chdir(ext_path) 
    95 #                copy_file(os.path.join(ext_path, ext_filename), os.path.join(ext_path, "lib"+ext_filename), link="sym") 
     98                # Get the shared library name 
    9699                lib_filename = self.compiler.library_filename(ext.name, lib_type="shared") 
    97                 ext.install_shared_link = (lib_filename, self.get_ext_filename(ext.name)) # store (lib_name, path) tuple to install shared library link to /usr/lib in the install_lib command 
    98 #                print realpath, ext_path, lib_filename 
     100                # Create the link 
    99101                copy_file(ext_filename, lib_filename, link="sym") 
    100 #                copy_file(ext_filename, lib_filename, link="sym") 
    101102            except OSError, ex: 
    102103                log.info("failed to create shared library for %s: %s" % (ext.name, str(ex))) 
     
    105106             
    106107    def build_pyxtract(self, ext): 
    107         ## mostly copied from build_extension, changed 
     108        ## mostly copied from build_extension 
    108109        sources = ext.sources 
    109110        if sources is None or type(sources) not in (ListType, TupleType): 
     
    312313            return os.path.join(package_dir, filename) 
    313314         
    314 class install_shared(install_lib): 
     315         
     316class my_install_lib(install_lib): 
     317    """ An command to install orange (preserves liborange.so -> orange.so symlink) 
     318    """ 
    315319    def run(self): 
    316320        install_lib.run(self) 
     
    318322    def copy_tree(self, infile, outfile, preserve_mode=1, preserve_times=1, preserve_symlinks=1, level=1): 
    319323        """ Run copy_tree with preserve_symlinks=1 as default 
     324        """  
     325        install_lib.copy_tree(self, infile, outfile, preserve_mode, preserve_times, preserve_symlinks, level) 
     326         
     327    def install(self): 
     328        """ Copy build_dir to install_dir 
    320329        """ 
    321         install_lib.copy_tree(self, infile, outfile, preserve_mode, preserve_times, preserve_symlinks, level) 
     330        # A Hack to unlink liborange.so -> orange.so if it already exists, 
     331        # because copy_tree fails to overwrite it 
     332        #  
     333        liborange = os.path.join(self.install_dir, "liborange.so") 
     334        if self.force and os.exists(liborange) and os.islink(liborange): 
     335            log.info("unlinking %s -> %s", liborange, os.path.join(self.install_dir, "orange.so")) 
     336            os.unlink(liborange) 
     337             
     338        return install_lib.install(self) 
    322339         
    323340             
     
    384401packages = [pkg.rpartition('/__init__.py')[0].replace('/','.') for pkg in matches] 
    385402 
    386 setup(cmdclass={"build_ext": pyxtract_build_ext, "install_lib": install_shared}, 
     403setup(cmdclass={"build_ext": pyxtract_build_ext, "install_lib": my_install_lib}, 
    387404      name ="Orange", 
    388405      version = "2.0.0b", 
Note: See TracChangeset for help on using the changeset viewer.