diff --git a/example_packages/hello_world/CMakeLists.txt b/example_packages/hello_world/CMakeLists.txt.example similarity index 100% rename from example_packages/hello_world/CMakeLists.txt rename to example_packages/hello_world/CMakeLists.txt.example diff --git a/example_packages/hello_world/README.md b/example_packages/hello_world/README.md index 7cf4729e9..8137345e3 100644 --- a/example_packages/hello_world/README.md +++ b/example_packages/hello_world/README.md @@ -1,14 +1,14 @@ Welcome to building your first rez package! -This package gets built using 'bez', a very simple python-based build system that -comes with rez. It reads the *rezbuild.py* file, and executes the *build* function -within, passing in build info such as *source_path* and *install_path*. +This package uses a simple python-based build script, and explicitly specifies +the build command using the `build_command` attribute in package.py. Rez has extensible support for other build systems, and comes with CMake support included. A *CMakeLists.txt.example* file is provided; to use cmake instead, just ensure that the cmake binary is visible; rename *CMakeLists.txt.example* to -*CMakeLists.txt*; and delete or rename *rezbuild.py*. Rez determines which build -system to use based on the build file found in the package source root. +*CMakeLists.txt*; and remove the `build_command` attribute from package.py. Rez +then determines which build system to use based on the build file found in the +package source root. When you run *rez-build -i*, rez uses your package's definition file (package.py) to create the correct build environment, and then runs the appropriate build diff --git a/example_packages/hello_world/build.py.example b/example_packages/hello_world/build.py similarity index 91% rename from example_packages/hello_world/build.py.example rename to example_packages/hello_world/build.py index 6859ad59c..3c63e6f5b 100644 --- a/example_packages/hello_world/build.py.example +++ b/example_packages/hello_world/build.py @@ -1,13 +1,9 @@ -""" -To use this as the build script, add to package.py: - - build_command = 'python {root}/build.py {install}' - -""" +#!/usr/bin/env python import os import os.path import shutil +import sys import stat @@ -54,7 +50,6 @@ def _install(): if __name__ == '__main__': - import os, sys build( source_path=os.environ['REZ_BUILD_SOURCE_PATH'], build_path=os.environ['REZ_BUILD_PATH'], diff --git a/example_packages/hello_world/package.py b/example_packages/hello_world/package.py index 99bd1dc48..80352d5cb 100644 --- a/example_packages/hello_world/package.py +++ b/example_packages/hello_world/package.py @@ -21,6 +21,8 @@ uuid = "examples.hello_world_py" +build_command = 'python {root}/build.py {install}' + def commands(): env.PYTHONPATH.append("{root}/python") env.PATH.append("{root}/bin") diff --git a/src/rez/cli/_bez.py b/src/rez/cli/_bez.py deleted file mode 100644 index 5c780ee7e..000000000 --- a/src/rez/cli/_bez.py +++ /dev/null @@ -1,109 +0,0 @@ -from __future__ import print_function - -import os -import sys -import os.path -import textwrap -import subprocess -import argparse -from rez.vendor import yaml -from rez.utils.execution import Popen -from rez.utils.filesystem import TempDirs -from rez.config import config - - -def run(): - parser = argparse.ArgumentParser( \ - description="Simple builtin Rez build system") - - parser.add_argument("TARGET", type=str, nargs='*', - help="build targets") - - opts = parser.parse_args() - - # check necessary files, load info about the build - for file in ("build.rxt", ".bez.yaml"): - if not os.path.isfile(file): - print("no %s file found. Stop." % file, file=sys.stderr) - sys.exit(1) - - with open(".bez.yaml") as f: - doc = yaml.load(f.read(), Loader=yaml.FullLoader) - - source_path = doc["source_path"] - buildfile = os.path.join(source_path, "rezbuild.py") - if not os.path.isfile(buildfile): - print("no rezbuild.py at %s. Stop." % source_path, file=sys.stderr) - sys.exit(1) - - # run rezbuild.py:build() in python subprocess. Cannot import module here - # because we're in a python env configured for rez, not the build - code = \ - """ - env={} - with open("%(buildfile)s") as stream: - exec(compile(stream.read(), stream.name, 'exec'), env) - - buildfunc = env.get("build") - if not buildfunc: - import sys - sys.stderr.write("Did not find function 'build' in rezbuild.py\\n") - sys.exit(1) - - kwargs = dict(source_path="%(srcpath)s", - build_path="%(bldpath)s", - install_path="%(instpath)s", - targets=%(targets)s, - build_args=%(build_args)s) - - import inspect - - if hasattr(inspect, "getfullargspec"): - # support py3 kw-only args - spec = inspect.getfullargspec(buildfunc) - args = spec.args + spec.kwonlyargs - else: - args = inspect.getargspec(buildfunc).args - - kwargs = dict((k, v) for k, v in kwargs.items() if k in args) - - buildfunc(**kwargs) - - """ % dict(buildfile=buildfile, - srcpath=source_path, - bldpath=doc["build_path"], - instpath=doc["install_path"], - targets=str(opts.TARGET or None), - build_args=str(doc.get("build_args") or [])) - - cli_code = textwrap.dedent(code).replace("\\", "\\\\") - - tmpdir_manager = TempDirs(config.tmpdir, prefix="bez_") - bezfile = os.path.join(tmpdir_manager.mkdtemp(), "bezfile") - with open(bezfile, "w") as fd: - fd.write(cli_code) - - print("executing rezbuild.py...") - cmd = [sys.executable, bezfile] - - with Popen(cmd) as p: - p.wait() - - tmpdir_manager.clear() - sys.exit(p.returncode) - - -# Copyright 2013-2016 Allan Johns. -# -# This library is free software: you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation, either -# version 3 of the License, or (at your option) any later version. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library. If not, see . diff --git a/src/rez/cli/_entry_points.py b/src/rez/cli/_entry_points.py index b987f3e00..1f8023bde 100644 --- a/src/rez/cli/_entry_points.py +++ b/src/rez/cli/_entry_points.py @@ -73,15 +73,6 @@ def run_rezolve(): return run() -@scriptname("bez") -def run_bez(): - # TODO: Deprecate. Use custom build commands instead. - # https://github.com/nerdvegas/rez/wiki/Building-Packages#custom-build-commands - check_production_install() - from rez.cli._bez import run - run() - - @scriptname("_rez-complete") def run_rez_complete(): check_production_install() diff --git a/src/rez/plugin_managers.py b/src/rez/plugin_managers.py index 02b17d38b..f6cc3f073 100644 --- a/src/rez/plugin_managers.py +++ b/src/rez/plugin_managers.py @@ -213,8 +213,7 @@ class RezPluginManager(object): rez, and the modules below that are individual custom plugins extending that type. - For example, rez provides three plugins of type 'build_system': 'cmake', - 'make' and 'bez':: + For example, rez provides plugins of type 'build_system': 'cmake' and 'make':: rezplugins/ __init__.py @@ -222,7 +221,6 @@ class RezPluginManager(object): __init__.py cmake.py make.py - bez.py ... Here is an example of how to provide your own plugin. In the example, diff --git a/src/rezplugins/build_system/custom.py b/src/rezplugins/build_system/custom.py index 3ae6a464e..1757333e3 100644 --- a/src/rezplugins/build_system/custom.py +++ b/src/rezplugins/build_system/custom.py @@ -105,8 +105,7 @@ def build(self, context, variant, build_path, install_path, install=False, ret = {} if self.write_build_scripts: - # write out the script that places the user in a build env, where - # they can run bez directly themselves. + # write out the script that places the user in a build env build_env_script = os.path.join(build_path, "build-env") create_forwarding_script(build_env_script, module=("build_system", "custom"), diff --git a/wiki/pages/Notes.md b/wiki/pages/Notes.md deleted file mode 100644 index 613fe1e41..000000000 --- a/wiki/pages/Notes.md +++ /dev/null @@ -1,4 +0,0 @@ - - -## Bez Deprecation -