[Pythonmac-SIG] PackageManager link broken?

Sarwat Khan sarwat at sarwat.net
Tue Sep 23 21:40:09 EDT 2003


> We're all screwed :)  I think you're the first person to mention it.  
> Certainly wasn't my idea to build packages to a specific point version 
> of OS X.

Yeah, that does bite. I just updated my userdefaults module because of 
that (separate post).

I used distutils to do my stuff instead of Package Manager, but it has 
the same problem. The distutils 'build.py' uses 
distutils.util.get_platform to get the name of the current platform 
when it creates build products, and get_platform returns a string that 
contains "darwin6.x", where the x is the current dot release of OS X. 
Which kind of sucks.

My workaround was to change the default build_platlib setting. I 
couldn't figure out how to change it via distutils.core.setup(), so I 
used my own Distribution class,

class Distribution (distutils.core.Distribution):

     def __init__(self, attrs=None):
         distutils.core.Distribution.__init__(self, attrs)

     def parse_config_files(self,  filenames=None):

         # a dynamic config that I don't know how to set through setup().
         # this ends up looking like "lib.darwin.2.3"
         build_platlib = "build/lib.%s.%d.%d" % \
             (sys.platform, int(sys.version[0]), 
int(sys.version_info[1]))

         self.command_options.setdefault('build', {})['build_platlib'] = 
\
             ("setup script", build_platlib)

         # by rule, config files override setup script (this script).
         distutils.core.Distribution.parse_config_files(self, filenames)

setup('distclass' : Distribution, ...)


This setting can be overridden by config files and the command line. 
Which is great solution if you're using distutils.core.setup; otherwise 
to fix Package Manager (which I know little about) you need to 
substitute distutils.util.get_platform for something else; something 
like what I used above.

{sarwat khan : http://sarwat.net}




More information about the Pythonmac-SIG mailing list