From ac28d1cb89c9ebc81177750ee4da121ad44e99c1 Mon Sep 17 00:00:00 2001 From: Dave Abrahams Date: Sat, 17 Mar 2007 20:25:04 +0000 Subject: [PATCH] tools/build/v2/tools/python.jam: * add ".lib" to the target name for libpython. *** This is a kluge! I don't know why it should be necessary ***, but when I was inserting debugging code that did ECHO [ $(target).name ] ; it would always drop the 2nd digit, e.g. python-2.4 would come out as "python-2". This change prevented it. * Fixed spelling and grammar in comments * Fix the incorrect assumption in capture-output that only one Python extension will participate (also in tools/build/v2/testing.jam). [SVN r37215] --- v2/tools/msvc.jam | 2 +- v2/tools/python.jam | 30 +++++++++++++++++------------- v2/tools/testing.jam | 2 +- 3 files changed, 19 insertions(+), 15 deletions(-) diff --git a/v2/tools/msvc.jam b/v2/tools/msvc.jam index 6ae565b9f..7579aebfc 100644 --- a/v2/tools/msvc.jam +++ b/v2/tools/msvc.jam @@ -855,7 +855,7 @@ else # Windows Manifests is a new way to specify dependencies # on managed DotNet assemblies and Windows native DLLs. The -# manifests are embedded as resourses and are useful in +# manifests are embedded as resources and are useful in # any PE targets (both DLL and EXE) if [ os.name ] in NT diff --git a/v2/tools/python.jam b/v2/tools/python.jam index 6318f5056..7034de4b1 100644 --- a/v2/tools/python.jam +++ b/v2/tools/python.jam @@ -635,7 +635,7 @@ local rule declare-libpython-target ( version ? : sys.platform ? : requirements # Compute the name of the target to declare local libpython-target-name = python $(version) $(sys.platform) ; - libpython-target-name = $(libpython-target-name:J=-) ; + libpython-target-name = $(libpython-target-name:J=-).lib ; # Declare and return it lib $(libpython-target-name) : : python$(lib-version) $(requirements) ; @@ -886,10 +886,10 @@ rule configured ( ) type.register PYTHON_EXTENSION : : SHARED_LIB ; -# We can't give "dll" suffix to PYTHON_EXTENSION, because -# we would not know what "a.dll" is: python extenstion or -# ordinary library. Therefore, we specify only suffixes -# used for generation of targets. +# We can't simply assign the "dll" or "so" suffix to PYTHON_EXTENSION, +# because then we wouldn't know whether "x.dll" is a python extension +# or an ordinary library. Therefore, we specify only the suffixes used +# for target generation. type.set-generated-target-suffix PYTHON_EXTENSION : : so ; type.set-generated-target-suffix PYTHON_EXTENSION : windows : pyd ; type.set-generated-target-suffix PYTHON_EXTENSION : cygwin : dll ; @@ -984,12 +984,15 @@ class python-test-generator : generator local extension = [ generators.construct $(project) $(name) : PYTHON_EXTENSION : $(property-set) : $(s) $(libs) ] ; - # The important part of usage requirements returned from - # PYTHON_EXTENSION genrator are xdll-path properties that - # will allow to find python extension at runtime. + # The important part of usage requirements returned + # from PYTHON_EXTENSION generator are xdll-path + # properties that will allow us to find the python + # extension at runtime. property-set = [ $(property-set).add $(extension[1]) ] ; - # Ignore usage requirements. We're top-level generator and - # nobody is going to use us. + + # Ignore usage requirements. We're a top-level + # generator and nobody is going to use what we + # generate. new-sources += $(extension[2-]) ; } } @@ -1032,13 +1035,14 @@ rule capture-output ( target : sources * : properties * ) # DLL. Only $(sources[1]) is passed to testing.capture-output, # so RUN_PATH variable on $(sources[2]) is not consulted. Move it # over explicitly. - RUN_PATH on $(sources[1]) = [ on $(sources[2]) return $(RUN_PATH) ] ; + RUN_PATH on $(sources[1]) = [ on $(sources[2-]) return $(RUN_PATH) ] ; + + PYTHONPATH = [ on $(sources[2-]) return $(LOCATE) $(SEARCH) ] ; - PYTHONPATH = [ on $(sources[2]) return $(LOCATE) ] ; # After test is run, we remove the Python module, but not the Python # script. testing.capture-output $(target) : $(sources[1]) : $(properties) - : $(sources[2]) ; + : $(sources[2-]) ; # PYTHONPATH is different; it will be interpreted by whichever # Python is invoked and so must follow path rules for the target diff --git a/v2/tools/testing.jam b/v2/tools/testing.jam index 946ca4bc6..4a5a24764 100644 --- a/v2/tools/testing.jam +++ b/v2/tools/testing.jam @@ -354,7 +354,7 @@ toolset.flags testing.capture-output LAUNCHER ; # - if 'none', does not remove anything, ever # - if empty, removes 'source' # - if non-empty and not 'none', contains a list of sources to remove. -rule capture-output ( target : source : properties * : targets-to-remove ? ) +rule capture-output ( target : source : properties * : targets-to-remove * ) { output-file on $(target) = $(target:S=.output) ; LOCATE on $(target:S=.output) = [ on $(target) return $(LOCATE) ] ;