Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

install variant.json file in the same manner as other extra install files #731

Merged
merged 1 commit into from
Sep 7, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/rez/utils/_version.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@


# Update this value to version up Rez. Do not place anything else in this file.
_rez_version = "2.44.0"
_rez_version = "2.44.1"


# Copyright 2013-2016 Allan Johns.
Expand Down
53 changes: 31 additions & 22 deletions src/rezplugins/build_process/local.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,12 +182,34 @@ def _build_variant_base(self, variant, build_type, install_path=None,
})
re_evaluated_variant = re_evaluated_package.get_variant(variant.index)

# create build environment
# create build environment (also creates build.rxt file)
context, rxt_filepath = self.create_build_context(
variant=re_evaluated_variant,
build_type=build_type,
build_path=variant_build_path)

# list of extra files (build.rxt etc) that are installed if an
# installation is taking place
#
extra_install_files = [rxt_filepath]

# create variant.json file. This identifies which variant this is.
# This is important for hashed variants, where it is not obvious
# which variant is in which root path. The file is there for
# debugging purposes only.
#
if variant.index is not None:
data = {
"index": variant.index,
"data": variant.parent.data["variants"][variant.index]
}

filepath = os.path.join(variant_build_path, "variant.json")
extra_install_files.append(filepath)

with open(filepath, 'w') as f:
json.dump(data, f, indent=2)

# run build system
build_system_name = self.build_system.name()
self._print("\nInvoking %s build system...", build_system_name)
Expand All @@ -204,27 +226,14 @@ def _build_variant_base(self, variant, build_type, install_path=None,
raise BuildError("The %s build system failed." % build_system_name)

if install:
# Install the 'variant.json' file, which identifies which variant
# this is. This is important for hashed variants, where it is not
# obvious which variant is in which root path. The file is there
# for debugging purposes only.
#
if variant.index is not None:
data = {
"index": variant.index,
"data": variant.parent.data["variants"][variant.index]
}

filepath = os.path.join(variant_install_path, "variant.json")
with open(filepath, 'w') as f:
json.dump(data, f, indent=2)

# install some files for debugging purposes (incl build.rxt)
extra_files = build_result.get("extra_files", [])
if rxt_filepath:
extra_files = extra_files + [rxt_filepath]

for file_ in extra_files:
# the build system can also specify extra files that need to
# be installed
filepaths = build_result.get("extra_files")
if filepaths:
extra_install_files.extend(filepaths)

# install extra files
for file_ in extra_install_files:
copy_or_replace(file_, variant_install_path)

# Install include modules. Note that this doesn't need to be done
Expand Down