mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
Add default values for options in the class init routine, not in the convenience wrapper function: distutils uses the class directly. Fixes bug #492665.
This commit is contained in:
parent
e54616cb6f
commit
81feb6c201
2 changed files with 17 additions and 14 deletions
|
@ -12,27 +12,15 @@ def mkproject(outputfile, modulename, settings, force=0, templatename=None):
|
||||||
for k, v in settings.items():
|
for k, v in settings.items():
|
||||||
dictcopy[k] = v
|
dictcopy[k] = v
|
||||||
#
|
#
|
||||||
# Fill in mac-specific values
|
# Generate the XML for the project
|
||||||
#
|
#
|
||||||
dictcopy['mac_projectxmlname'] = outputfile + '.xml'
|
dictcopy['mac_projectxmlname'] = outputfile + '.xml'
|
||||||
dictcopy['mac_exportname'] = os.path.split(outputfile)[1] + '.exp'
|
dictcopy['mac_exportname'] = os.path.split(outputfile)[1] + '.exp'
|
||||||
if not dictcopy.has_key('mac_outputdir'):
|
|
||||||
dictcopy['mac_outputdir'] = ':lib:'
|
|
||||||
if not dictcopy.has_key('stdlibraryflags'):
|
|
||||||
dictcopy['stdlibraryflags'] = 'Debug'
|
|
||||||
if not dictcopy.has_key('libraryflags'):
|
|
||||||
dictcopy['libraryflags'] = 'Debug'
|
|
||||||
if not dictcopy.has_key('mac_dllname'):
|
if not dictcopy.has_key('mac_dllname'):
|
||||||
dictcopy['mac_dllname'] = modulename + '.ppc.slb'
|
dictcopy['mac_dllname'] = modulename + '.ppc.slb'
|
||||||
if not dictcopy.has_key('mac_targetname'):
|
if not dictcopy.has_key('mac_targetname'):
|
||||||
dictcopy['mac_targetname'] = modulename + '.ppc'
|
dictcopy['mac_targetname'] = modulename + '.ppc'
|
||||||
if os.path.isabs(dictcopy['sysprefix']):
|
|
||||||
dictcopy['mac_sysprefixtype'] = 'Absolute'
|
|
||||||
else:
|
|
||||||
dictcopy['mac_sysprefixtype'] = 'Project' # XXX not sure this is right...
|
|
||||||
#
|
|
||||||
# Generate the XML for the project
|
|
||||||
#
|
|
||||||
xmlbuilder = cwxmlgen.ProjectBuilder(dictcopy, templatename=templatename)
|
xmlbuilder = cwxmlgen.ProjectBuilder(dictcopy, templatename=templatename)
|
||||||
xmlbuilder.generate()
|
xmlbuilder.generate()
|
||||||
if not force:
|
if not force:
|
||||||
|
|
|
@ -20,6 +20,7 @@ TEMPLATELIST= [
|
||||||
|
|
||||||
class ProjectBuilder:
|
class ProjectBuilder:
|
||||||
def __init__(self, dict, templatelist=TEMPLATELIST, templatename=None):
|
def __init__(self, dict, templatelist=TEMPLATELIST, templatename=None):
|
||||||
|
self._adddefaults(dict)
|
||||||
if templatename == None:
|
if templatename == None:
|
||||||
if hasattr(MacOS, 'runtimemodel'):
|
if hasattr(MacOS, 'runtimemodel'):
|
||||||
templatename = 'template-%s'%MacOS.runtimemodel
|
templatename = 'template-%s'%MacOS.runtimemodel
|
||||||
|
@ -44,6 +45,20 @@ class ProjectBuilder:
|
||||||
self.templatelist = templatelist
|
self.templatelist = templatelist
|
||||||
self.templatedir = templatedir
|
self.templatedir = templatedir
|
||||||
|
|
||||||
|
def _adddefaults(self, dict):
|
||||||
|
# Set all suitable defaults set for values which were omitted.
|
||||||
|
if not dict.has_key('mac_outputdir'):
|
||||||
|
dict['mac_outputdir'] = ':lib:'
|
||||||
|
if not dict.has_key('stdlibraryflags'):
|
||||||
|
dict['stdlibraryflags'] = 'Debug'
|
||||||
|
if not dict.has_key('libraryflags'):
|
||||||
|
dict['libraryflags'] = 'Debug'
|
||||||
|
if not dict.has_key('mac_sysprefixtype'):
|
||||||
|
if os.path.isabs(dict['sysprefix']):
|
||||||
|
dict['mac_sysprefixtype'] = 'Absolute'
|
||||||
|
else:
|
||||||
|
dict['mac_sysprefixtype'] = 'Project' # XXX not sure this is right...
|
||||||
|
|
||||||
def generate(self):
|
def generate(self):
|
||||||
for tmpl in self.templatelist:
|
for tmpl in self.templatelist:
|
||||||
self._generate_one_template(tmpl)
|
self._generate_one_template(tmpl)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue