Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
properties.extend(build_ps.get_properties('dependency'))
properties.extend(build_ps.get_properties('location'))
properties.extend(build_ps.get_properties('install-no-version-symlinks'))
d = build_ps.get_properties('install-source-root')
# Make the path absolute: we shall use it to compute relative paths and
# making the path absolute will help.
if d:
p = d[0]
properties.append(property.Property(p.feature, os.path.abspath(p.value)))
return property_set.create(properties)
def boost_std(inc = None, lib = None):
# The default definitions for pre-built libraries.
rules.project(
['boost'],
['usage-requirements'] + ['{}'.format(i) for i in inc] + ['BOOST_ALL_NO_LIB'],
['requirements'] + ['{}'.format(l) for l in lib])
# TODO: There should be a better way to add a Python function into a
# project requirements property set.
tag_prop_set = property_set.create([property.Property('', tag_std)])
attributes = projects.attributes(projects.current().project_module())
attributes.requirements = attributes.requirements.refine(tag_prop_set)
alias('headers')
def boost_lib(lib_name, dyn_link_macro):
if (isinstance(lib_name,str)):
lib_name = [lib_name]
builtin.lib(lib_name, usage_requirements=['shared:{}'.format(dyn_link_macro)])
boost_lib('container' , 'BOOST_CONTAINER_DYN_LINK' )
boost_lib('date_time' , 'BOOST_DATE_TIME_DYN_LINK' )
boost_lib('filesystem' , 'BOOST_FILE_SYSTEM_DYN_LINK' )
boost_lib('graph' , 'BOOST_GRAPH_DYN_LINK' )
boost_lib('graph_parallel' , 'BOOST_GRAPH_DYN_LINK' )
boost_lib('iostreams' , 'BOOST_IOSTREAMS_DYN_LINK' )
extra += replace_grist(paths, '')
# We need to pass features that we've got from sources,
# because if shared library is built, exe which uses it must know paths
# to other shared libraries this one depends on, to be able to find them
# all at runtime.
# Just pass all features in property_set, it's theorically possible
# that we'll propagate features explicitly specified by
# the user, but then the user's to blaim for using internal feature.
values = prop_set.get('')
extra += replace_grist(values, '')
if extra:
result = property_set.create(extra)
return result
% (specification, non_free))
t = property.translate_paths(
property.create_from_strings(specification, allow_condition=True),
self.location)
existing = self.__dict__.get("usage-requirements")
if existing:
new = property_set.create(existing.all() + t)
else:
new = property_set.create(t)
self.__dict__["usage-requirements"] = new
elif attribute == "default-build":
self.__dict__["default-build"] = property_set.create(specification)
elif attribute == "source-location":
source_location = []
for path in specification:
source_location.append(os.path.join(self.location, path))
self.__dict__["source-location"] = source_location
elif attribute == "build-dir":
self.__dict__["build-dir"] = os.path.join(self.location, specification[0])
elif attribute == "id":
id = specification[0]
if id[0] != '/':
id = "/" + id
self.manager.projects().register_id(id, self.project_module)
self.__dict__["id"] = id
unconditional.append(p)
non_free = property.remove("free", unconditional)
if non_free:
get_manager().errors()("usage-requirements %s have non-free properties %s" \
% (specification, non_free))
t = property.translate_paths(
property.create_from_strings(specification, allow_condition=True),
self.location)
existing = self.__dict__.get("usage-requirements")
if existing:
new = property_set.create(existing.all() + t)
else:
new = property_set.create(t)
self.__dict__["usage-requirements"] = new
elif attribute == "default-build":
self.__dict__["default-build"] = property_set.create(specification)
elif attribute == "source-location":
source_location = []
for path in specification:
source_location.append(os.path.join(self.location, path))
self.__dict__["source-location"] = source_location
elif attribute == "build-dir":
self.__dict__["build-dir"] = os.path.join(self.location, specification[0])
elif attribute == "id":
def check(self, ps):
# FIXME: this should not be hardcoded. Other checks might
# want to consider different set of features as relevant.
toolset = ps.get('toolset')[0]
toolset_version_property = "" ;
relevant = ps.get_properties('target-os') + \
ps.get_properties("toolset") + \
ps.get_properties(toolset_version_property) + \
ps.get_properties("address-model") + \
ps.get_properties("architecture")
rps = property_set.create(relevant)
t = get_manager().targets().current()
p = t.project()
if builds(self.target, p, rps, "%s builds" % self.target):
choosen = self.true_properties
else:
choosen = self.false_properties
return property.evaluate_conditionals_in_context(choosen, ps)
# hardcode paths to dependent libraries.
if prop_set.get('') == ['true'] \
and type.is_derived(self.target_types_ [0], 'EXE'):
xdll_path = prop_set.get('')
extra.extend(property.Property('', sp) \
for sp in extra_xdll_path)
extra.extend(property.Property('', sp) \
for sp in xdll_path)
if extra:
prop_set = prop_set.add_raw (extra)
result = generators.Generator.run(self, project, name, prop_set, sources)
if result:
ur = self.extra_usage_requirements(result, prop_set)
ur = ur.add(property_set.create(['' + p for p in extra_xdll_path]))
else:
return None
return (ur, result)
import bjam
from b2.build import alias, property, property_set, feature
from b2.manager import get_manager
from b2.tools import builtin, common
from b2.util import bjam_signature, regex
# TODO: This is currently necessary in Python Port, but was not in Jam.
feature.feature('layout', ['system', 'versioned', 'tag'], ['optional'])
feature.feature('root', [], ['optional', 'free'])
feature.feature('build-id', [], ['optional', 'free'])
__initialized = None
__boost_auto_config = property_set.create([property.Property('layout', 'system')])
__boost_configured = {}
__boost_default = None
__build_id = None
__debug = None
def debug():
global __debug
if __debug is None:
__debug = "--debug-configuration" in bjam.variable("ARGV")
return __debug
# Configuration of the boost library to use.
#
# This can either be a boost source tree or
def expand_no_defaults (property_sets):
""" Expand the given build request by combining all property_sets which don't
specify conflicting non-free features.
"""
assert is_iterable_typed(property_sets, property_set.PropertySet)
# First make all features and subfeatures explicit
expanded_property_sets = [ps.expand_subfeatures() for ps in property_sets]
# Now combine all of the expanded property_sets
product = __x_product (expanded_property_sets)
return [property_set.create(p) for p in product]
properties.extend(build_ps.get_properties('dependency'))
properties.extend(build_ps.get_properties('location'))
properties.extend(build_ps.get_properties('install-no-version-symlinks'))
d = build_ps.get_properties('install-source-root')
# Make the path absolute: we shall use it to compute relative paths and
# making the path absolute will help.
if d:
p = d[0]
properties.append(property.Property(p.feature, os.path.abspath(p.value)))
return property_set.create(properties)