Boost logo

Boost-Commit :

From: daniel_at_[hidden]
Date: 2007-10-10 15:59:25


Author: danielw
Date: 2007-10-10 15:59:24 EDT (Wed, 10 Oct 2007)
New Revision: 39904
URL: http://svn.boost.org/trac/boost/changeset/39904

Log:
Ported `alias` target type to Python.

Added:
   branches/build/python_port/python/boost/build/build/alias.py (contents, props changed)

Added: branches/build/python_port/python/boost/build/build/alias.py
==============================================================================
--- (empty file)
+++ branches/build/python_port/python/boost/build/build/alias.py 2007-10-10 15:59:24 EDT (Wed, 10 Oct 2007)
@@ -0,0 +1,57 @@
+# Copyright 2003, 2004, 2006 Vladimir Prus
+# Distributed under the Boost Software License, Version 1.0.
+# (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
+
+# This module defines the 'alias' rule and associated class.
+#
+# Alias is just a main target which returns its source targets without any
+# processing. For example::
+#
+# alias bin : hello test_hello ;
+# alias lib : helpers xml_parser ;
+#
+# Another important use of 'alias' is to conveniently group source files::
+#
+# alias platform-src : win.cpp : <os>NT ;
+# alias platform-src : linux.cpp : <os>LINUX ;
+# exe main : main.cpp platform-src ;
+#
+# Lastly, it's possible to create local alias for some target, with different
+# properties::
+#
+# alias big_lib : : @/external_project/big_lib/<link>static ;
+#
+
+# Status: ported (danielw)
+
+import targets
+import property_set
+from boost.build.manager import get_manager
+
+class AliasTarget(targets.BasicTarget):
+
+ def __init__(self, *args):
+ targets.BasicTarget.__init__(self, *args)
+
+ def construct(self, name, source_targets, properties):
+ return [property_set.empty(), source_targets]
+
+ def compute_usage_requirements(self, subvariant):
+ base = targets.BasicTarget.compute_usage_requirements(self, subvariant)
+ # Add source's usage requirement. If we don't do this, "alias" does not
+ # look like 100% alias.
+ return base.add(subvariant.sources_usage_requirements())
+
+def alias(self, name, sources, requirements=[], default_build=[], usage_requirements=[]):
+ project = get_manager().projects().current()
+ targets = get_manager().targets()
+ targets.main_target_alternative(AliasTarget(
+ name[0], project,
+ targets.main_target_sources(sources, name),
+ targets.main_target_requirements(requirements, project),
+ targets.main_target_default_build(default_build, project),
+ targets.main_target_usage_requirements(usage_requirements, project)))
+
+# Declares the 'alias' target. It will build sources, and return them unaltered.
+get_manager().projects().add_rule("alias", alias)
+


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk