[Distutils] Alternate static metadata PEP submission...

David Lyon david.lyon at preisshare.net
Fri Oct 16 06:35:07 CEST 2009


On Fri, 16 Oct 2009 12:22:20 +0900, David Cournapeau wrote:
> The problem is a bit more complicated, because it cannot be handled in
> one single section.

I really appreciate you sharing this challenge with me.

I'm really convinced that I can "tweak" something to make it work. And
now is a really good time for me to examine it because I'm coding now.

Let me post how the code is looking:

    def main():
 
        # -- Return Code
        rc = 0
        
        # -- Check for our config file
        if not os.path.exists(setupconfigname):
            logger.error("No %s file found. Installation is unable to
proceed" % setupconfigname)
            sys.exit(10)

        try:
            # -- See what our platform is
            build_platform_bit_map()
   
            # -- Work out where to copy files to
            build_local_directory_targets()
    
            # -- Load basic install information
            load_basic_install_requirements()
 
            # -- Process python package dependencies
            process_dependencies()

            # -- Build a list of all the files that need to be copied
            build_file_copy_list()
 
            # -- Check that all the files in the copy list exist and are
ready for copying
            validate_file_list()
 
            # -- Run preinstall scripts
            run_preinstall_scripts()

            # -- Copy files to the local system
            copy_files()
 
            # -- Adjust the python configuration
            finalise_python()

            # -- Update platform links/shortcuts
            finalise_local_links()

            # -- Run postinstall scripts
            run_postinstall_scripts()
 
        except:
            rollback():
            rc = 1
            
        return rc

So let's just take what you wrote step by step..

> You need to detect cython (configuration stage)

cython is a type of python interpretor? like jython or ironpython

Assuming yes, 

> you need to modify the extensions sources depending on this, and you need
to
> install different files depending on this:

[Application]
scripts = artisticflairgui.py

[Application cython]
scripts = artisticflairguicython.py

That's a different file being installed if we detect we are using cython
and not python.

Since we are copying files "out", like we used to do, we can include
all the files that we need in our package. Only the files needed for
the local platform end up getting copied.

> it touches at least config,
> build_ext and install commands to use the distutils terminology.

[postinstall]
scripts = buildit.py

[postinstall cython]
scripts = builtitspecialforcython.py

[postinstall jython]
scripts = builtitspecialforjython.py

[postinstall ironpython]
scripts = killvistaupgradetowin7.py

> This is similar to my main complain about distutils: you can't easily
> share data between commands. AFAIK, the only way to do it is to use the
> Distribute class instance, which is problematic as that's what most
> tools on top of distutils need to monkey-patch.

It seems to be a really unusual (for me) problem. But I don't dispute
that its a real problem. I don't follow all the python spin offs
but I agree that they need to be. Hence, they need bits (constants).

I just hope I'm understanding the problem the right way.

Maybe next week I might even have something that can be tried to see
if it will work. I'm busy coding now, so you asked at a good time.

David




More information about the Distutils-SIG mailing list