Survey of complex usage of distutils.

Carl Banks imbosol at aerojockey.com
Thu May 15 01:41:53 EDT 2003


[also mailed]

Anthony Baxter wrote:
> I'm currently documenting the Distutils innards (working document can
> be found at http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/python/python/nondist/sandbox/distutilsref).
> As part of this I'm identifying bits of distutils that could be removed,
> or replaced with standard python modules. The two modules most likely 
> at the moment are distutils.log and distutils.fancy_getopt. 
> 
> The problem is that no-one knows what people are using today from distutils.
> There's never been an "official" API, so it's possible that there's wild
> and wacky usage of distutils internals. If you have written a setup.py that
> is using more than just the basic distutils.core functionality, could you
> please contact me and let me know what other functionality you're using?
> Similarly, if you know of a package that uses more complex distutils code,
> I'd like to hear about it.



Because there was no way (as far as I could tell) for Python scripts
to determine where the data files were installed, my setup.py usually
had something like this following call to setup, which looked into the
distutil structure and created a minimal Python module specifying the
data directory:


if (not dist.dry_run and dist.command_obj.has_key('install_data')
    and dist.command_obj.has_key('install_lib')):
        data_install_dir = dist.command_obj['install_data'].install_dir
        include_dir = os.path.join(data_install_dir, 'lib', 'hrl')
        lib_install_dir = dist.command_obj['install_lib'].install_dir
        lib_file =  os.path.join(lib_install_dir, 'HRL', 'info.py')
        print "writing %s" % lib_file
        f = open(lib_file,'w')
        f.write("include_dir = %s\n" % repr(include_dir))
        f.close()
        compile(lib_file)


I hope this oversight in distutils will disappear soon, so I can take
this hack out of my setup scripts.


-- 
CARL BANKS




More information about the Python-list mailing list