mirror of
https://github.com/python/cpython.git
synced 2025-11-02 22:51:25 +00:00
Added 'runtime_library_dirs' parameter to 'link_*()' methods.
Split '_fix_link_args()' up into '_fix_object_args()' (for use of 'create_static_lib() and link methods) and '_fix_lib_args()' (for the link methods only).
This commit is contained in:
parent
158ce4247e
commit
f10f95d6bb
1 changed files with 43 additions and 28 deletions
|
|
@ -338,16 +338,11 @@ def _prep_compile (self, sources, output_dir):
|
||||||
# _prep_compile ()
|
# _prep_compile ()
|
||||||
|
|
||||||
|
|
||||||
def _fix_link_args (self, objects, output_dir,
|
def _fix_object_args (self, objects, output_dir):
|
||||||
takes_libs=0, libraries=None, library_dirs=None):
|
"""Typecheck and fix up some arguments supplied to various
|
||||||
"""Typecheck and fix up some of the arguments supplied to the
|
methods. Specifically: ensure that 'objects' is a list; if
|
||||||
'link_*' methods and return the fixed values. Specifically:
|
output_dir is None, replace with self.output_dir. Return fixed
|
||||||
ensure that 'objects' is a list; if output_dir is None, use
|
versions of 'objects' and 'output_dir'."""
|
||||||
self.output_dir; ensure that 'libraries' and 'library_dirs' are
|
|
||||||
both lists, and augment them with 'self.libraries' and
|
|
||||||
'self.library_dirs'. If 'takes_libs' is true, return a tuple
|
|
||||||
(objects, output_dir, libraries, library_dirs; else return
|
|
||||||
(objects, output_dir)."""
|
|
||||||
|
|
||||||
if type (objects) not in (ListType, TupleType):
|
if type (objects) not in (ListType, TupleType):
|
||||||
raise TypeError, \
|
raise TypeError, \
|
||||||
|
|
@ -359,28 +354,45 @@ def _fix_link_args (self, objects, output_dir,
|
||||||
elif type (output_dir) is not StringType:
|
elif type (output_dir) is not StringType:
|
||||||
raise TypeError, "'output_dir' must be a string or None"
|
raise TypeError, "'output_dir' must be a string or None"
|
||||||
|
|
||||||
if takes_libs:
|
return (objects, output_dir)
|
||||||
if libraries is None:
|
|
||||||
libraries = self.libraries
|
|
||||||
elif type (libraries) in (ListType, TupleType):
|
|
||||||
libraries = list (libraries) + (self.libraries or [])
|
|
||||||
else:
|
|
||||||
raise TypeError, \
|
|
||||||
"'libraries' (if supplied) must be a list of strings"
|
|
||||||
|
|
||||||
if library_dirs is None:
|
|
||||||
library_dirs = self.library_dirs
|
|
||||||
elif type (library_dirs) in (ListType, TupleType):
|
|
||||||
library_dirs = list (library_dirs) + (self.library_dirs or [])
|
|
||||||
else:
|
|
||||||
raise TypeError, \
|
|
||||||
"'library_dirs' (if supplied) must be a list of strings"
|
|
||||||
|
|
||||||
return (objects, output_dir, libraries, library_dirs)
|
def _fix_lib_args (self, libraries, library_dirs, runtime_library_dirs):
|
||||||
|
"""Typecheck and fix up some of the arguments supplied to the
|
||||||
|
'link_*' methods. Specifically: ensure that all arguments are
|
||||||
|
lists, and augment them with their permanent versions
|
||||||
|
(eg. 'self.libraries' augments 'libraries'). Return a tuple
|
||||||
|
with fixed versions of all arguments."""
|
||||||
|
|
||||||
|
if libraries is None:
|
||||||
|
libraries = self.libraries
|
||||||
|
elif type (libraries) in (ListType, TupleType):
|
||||||
|
libraries = list (libraries) + (self.libraries or [])
|
||||||
else:
|
else:
|
||||||
return (objects, output_dir)
|
raise TypeError, \
|
||||||
|
"'libraries' (if supplied) must be a list of strings"
|
||||||
|
|
||||||
# _fix_link_args ()
|
if library_dirs is None:
|
||||||
|
library_dirs = self.library_dirs
|
||||||
|
elif type (library_dirs) in (ListType, TupleType):
|
||||||
|
library_dirs = list (library_dirs) + (self.library_dirs or [])
|
||||||
|
else:
|
||||||
|
raise TypeError, \
|
||||||
|
"'library_dirs' (if supplied) must be a list of strings"
|
||||||
|
|
||||||
|
if runtime_library_dirs is None:
|
||||||
|
runtime_library_dirs = self.runtime_library_dirs
|
||||||
|
elif type (runtime_library_dirs) in (ListType, TupleType):
|
||||||
|
runtime_library_dirs = (list (runtime_library_dirs) +
|
||||||
|
(self.runtime_library_dirs or []))
|
||||||
|
else:
|
||||||
|
raise TypeError, \
|
||||||
|
"'runtime_library_dirs' (if supplied) " + \
|
||||||
|
"must be a list of strings"
|
||||||
|
|
||||||
|
return (libraries, library_dirs, runtime_library_dirs)
|
||||||
|
|
||||||
|
# _fix_lib_args ()
|
||||||
|
|
||||||
|
|
||||||
def _need_link (self, objects, output_file):
|
def _need_link (self, objects, output_file):
|
||||||
|
|
@ -480,6 +492,7 @@ def link_shared_lib (self,
|
||||||
output_dir=None,
|
output_dir=None,
|
||||||
libraries=None,
|
libraries=None,
|
||||||
library_dirs=None,
|
library_dirs=None,
|
||||||
|
runtime_library_dirs=None,
|
||||||
debug=0,
|
debug=0,
|
||||||
extra_preargs=None,
|
extra_preargs=None,
|
||||||
extra_postargs=None):
|
extra_postargs=None):
|
||||||
|
|
@ -522,6 +535,7 @@ def link_shared_object (self,
|
||||||
output_dir=None,
|
output_dir=None,
|
||||||
libraries=None,
|
libraries=None,
|
||||||
library_dirs=None,
|
library_dirs=None,
|
||||||
|
runtime_library_dirs=None,
|
||||||
debug=0,
|
debug=0,
|
||||||
extra_preargs=None,
|
extra_preargs=None,
|
||||||
extra_postargs=None):
|
extra_postargs=None):
|
||||||
|
|
@ -540,6 +554,7 @@ def link_executable (self,
|
||||||
output_dir=None,
|
output_dir=None,
|
||||||
libraries=None,
|
libraries=None,
|
||||||
library_dirs=None,
|
library_dirs=None,
|
||||||
|
runtime_library_dirs=None,
|
||||||
debug=0,
|
debug=0,
|
||||||
extra_preargs=None,
|
extra_preargs=None,
|
||||||
extra_postargs=None):
|
extra_postargs=None):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue