Skip to content

Commit

Permalink
deprecated bez
Browse files Browse the repository at this point in the history
  • Loading branch information
ajohns committed Nov 25, 2020
1 parent 9e5b7d6 commit 603766e
Show file tree
Hide file tree
Showing 27 changed files with 156 additions and 185 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
"""
To use this as the build script, add to package.py:

build_command = 'python {root}/build.py {install}'

"""

import os
import os.path
import shutil
Expand Down Expand Up @@ -44,3 +51,13 @@ def build(source_path, build_path, install_path, targets):

if "install" in (targets or []):
_install()


if __name__ == '__main__':
import os, sys
build(
source_path=os.environ['REZ_BUILD_SOURCE_PATH'],
build_path=os.environ['REZ_BUILD_PATH'],
install_path=os.environ['REZ_BUILD_INSTALL_PATH'],
targets=sys.argv[1:]
)
30 changes: 30 additions & 0 deletions src/rez/build_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,36 @@ def create_build_system(working_dir, buildsys_type=None, package=None, opts=None
clss = get_valid_build_systems(working_dir, package=package)

if not clss:
# Special case - bez. This is an old deprecated build system,
# which expects a rezbuild.py file. Include info in error showing
# how to port to a custom build command.
#
if os.path.exists(os.path.join(working_dir, "rezbuild.py")):
msg = (
"No build system is associated with the path %s.\n"
"\n"
"There is a rezbuild.py file present, suggesting you were "
"using the deprecated bez build system. You need to use a "
"custom build command instead. You port your existing "
"rezbuild.py like so:\n"
"\n"
"Add this line to package.py:\n"
"\n"
" build_command = 'python {root}/rezbuild.py {install}'\n"
"\n"
"Add these lines to rezbuild.py:\n"
"\n"
" if __name__ == '__main__':\n"
" import os, sys\n"
" build(\n"
" source_path=os.environ['REZ_BUILD_SOURCE_PATH'],\n"
" build_path=os.environ['REZ_BUILD_PATH'],\n"
" install_path=os.environ['REZ_BUILD_INSTALL_PATH'],\n"
" targets=sys.argv[1:]\n"
" )"
)
raise BuildSystemError(msg % working_dir)

raise BuildSystemError(
"No build system is associated with the path %s" % working_dir)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,16 @@ def build(source_path, build_path, install_path, targets):
pass


if __name__ == '__main__':
import os, sys
build(
source_path=os.environ['REZ_BUILD_SOURCE_PATH'],
build_path=os.environ['REZ_BUILD_PATH'],
install_path=os.environ['REZ_BUILD_INSTALL_PATH'],
targets=sys.argv[1:]
)


# Copyright 2013-2016 Allan Johns.
#
# This library is free software: you can redistribute it and/or
Expand Down
2 changes: 2 additions & 0 deletions src/rez/tests/data/builds/packages/anti/1.0.0/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
def commands():
env.PYTHONPATH.append('{root}/python')

build_command = 'python {root}/build.py {install}'


# Copyright 2013-2016 Allan Johns.
#
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,16 @@ def build(source_path, build_path, install_path, targets):
install_path=install_path)


if __name__ == '__main__':
import os, sys
build(
source_path=os.environ['REZ_BUILD_SOURCE_PATH'],
build_path=os.environ['REZ_BUILD_PATH'],
install_path=os.environ['REZ_BUILD_INSTALL_PATH'],
targets=sys.argv[1:]
)


# Copyright 2013-2016 Allan Johns.
#
# This library is free software: you can redistribute it and/or
Expand Down
2 changes: 2 additions & 0 deletions src/rez/tests/data/builds/packages/bah/2.1/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

hashed_variants = True

build_command = 'python {root}/build.py {install}'


# Copyright 2013-2016 Allan Johns.
#
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,16 @@ def _copy(src, dest):
_copy(src, dest)


if __name__ == '__main__':
import os, sys
build(
source_path=os.environ['REZ_BUILD_SOURCE_PATH'],
build_path=os.environ['REZ_BUILD_PATH'],
install_path=os.environ['REZ_BUILD_INSTALL_PATH'],
targets=sys.argv[1:]
)


# Copyright 2013-2016 Allan Johns.
#
# This library is free software: you can redistribute it and/or
Expand Down
2 changes: 2 additions & 0 deletions src/rez/tests/data/builds/packages/build_util/1/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
def commands():
env.PYTHONPATH.append('{root}/python')

build_command = 'python {root}/build.py {install}'


# Copyright 2013-2016 Allan Johns.
#
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,16 @@ def build(source_path, build_path, install_path, targets):
install_path=install_path)


if __name__ == '__main__':
import os, sys
build(
source_path=os.environ['REZ_BUILD_SOURCE_PATH'],
build_path=os.environ['REZ_BUILD_PATH'],
install_path=os.environ['REZ_BUILD_INSTALL_PATH'],
targets=sys.argv[1:]
)


# Copyright 2013-2016 Allan Johns.
#
# This library is free software: you can redistribute it and/or
Expand Down
2 changes: 2 additions & 0 deletions src/rez/tests/data/builds/packages/floob/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
def commands():
env.PYTHONPATH.append('{root}/python')

build_command = 'python {root}/build.py {install}'


# Copyright 2013-2016 Allan Johns.
#
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,16 @@ def build(source_path, build_path, install_path, targets):
install_path=install_path)


if __name__ == '__main__':
import os, sys
build(
source_path=os.environ['REZ_BUILD_SOURCE_PATH'],
build_path=os.environ['REZ_BUILD_PATH'],
install_path=os.environ['REZ_BUILD_INSTALL_PATH'],
targets=sys.argv[1:]
)


# Copyright 2013-2016 Allan Johns.
#
# This library is free software: you can redistribute it and/or
Expand Down
2 changes: 2 additions & 0 deletions src/rez/tests/data/builds/packages/foo/1.0.0/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ def pre_build_commands():
def commands():
env.PYTHONPATH.append('{root}/python')

build_command = 'python {root}/build.py {install}'


# Copyright 2013-2016 Allan Johns.
#
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,16 @@ def build(source_path, build_path, install_path, targets):
install_path=install_path)


if __name__ == '__main__':
import os, sys
build(
source_path=os.environ['REZ_BUILD_SOURCE_PATH'],
build_path=os.environ['REZ_BUILD_PATH'],
install_path=os.environ['REZ_BUILD_INSTALL_PATH'],
targets=sys.argv[1:]
)


# Copyright 2013-2016 Allan Johns.
#
# This library is free software: you can redistribute it and/or
Expand Down
2 changes: 2 additions & 0 deletions src/rez/tests/data/builds/packages/foo/1.1.0/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ def commands():

late_utils.add_eek_var(env)

build_command = 'python {root}/build.py {install}'


# Copyright 2013-2016 Allan Johns.
#
Expand Down
2 changes: 2 additions & 0 deletions src/rez/tests/data/builds/packages/loco/3/build.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

# intentionally empty
2 changes: 2 additions & 0 deletions src/rez/tests/data/builds/packages/loco/3/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
# deliberate conflict
requires = ["foo-1.0", "foo-1.1"]

build_command = "python {root}/build.py {install}"


# Copyright 2013-2016 Allan Johns.
#
Expand Down
20 changes: 0 additions & 20 deletions src/rez/tests/data/builds/packages/loco/3/rezbuild.py

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,8 +1,20 @@
import os
import sys


def build(source_path, build_path, install_path, targets):
raise Exception("This build is deliberately broken")


if __name__ == '__main__':
build(
source_path=os.environ['REZ_BUILD_SOURCE_PATH'],
build_path=os.environ['REZ_BUILD_PATH'],
install_path=os.environ['REZ_BUILD_INSTALL_PATH'],
targets=sys.argv[1:]
)


# Copyright 2013-2016 Allan Johns.
#
# This library is free software: you can redistribute it and/or
Expand Down
2 changes: 2 additions & 0 deletions src/rez/tests/data/builds/packages/whack/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
uuid = "4e9f63cbc4794453b0031f0c5ff50759"
description = "a deliberately broken package"

build_command = "python {root}/build.py {install}"


# Copyright 2013-2016 Allan Johns.
#
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import shutil
import os.path
import os
import sys


def build(source_path, build_path, install_path, targets):
Expand All @@ -26,6 +28,15 @@ def _copy(src, dest):
_copy(src, dest)


if __name__ == '__main__':
build(
source_path=os.environ['REZ_BUILD_SOURCE_PATH'],
build_path=os.environ['REZ_BUILD_PATH'],
install_path=os.environ['REZ_BUILD_INSTALL_PATH'],
targets=sys.argv[1:]
)


# Copyright 2013-2016 Allan Johns.
#
# This library is free software: you can redistribute it and/or
Expand Down
2 changes: 2 additions & 0 deletions src/rez/tests/data/release/package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ authors:
- joe.bloggs
uuid: '9982b60993af4a4d89e8372472a49d02'
description: 'foo type thing'

build_command: "python {root}/build.py {install}"
2 changes: 2 additions & 0 deletions src/rez/tests/data/release/variants/build.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

# intentionally empty
2 changes: 2 additions & 0 deletions src/rez/tests/data/release/variants/package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ description: 'a package with two variants'
variants:
- ['spangle-1.0']
- ['spangle-1.1']

build_command: "python {root}/build.py {install}"
6 changes: 0 additions & 6 deletions src/rez/tests/data/release/variants/rezbuild.py

This file was deleted.

2 changes: 1 addition & 1 deletion src/rez/tests/test_release.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def _setup_release(self):

# check build system type
buildsys = create_build_system(self.src_root, verbose=True)
self.assertEqual(buildsys.name(), "bez")
self.assertEqual(buildsys.name(), "custom")

# create the vcs - should error because stub file doesn't exist yet
with self.assertRaises(ReleaseVCSError):
Expand Down
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.69.6"
_rez_version = "2.70.0"


# Copyright 2013-2016 Allan Johns.
Expand Down
Loading

0 comments on commit 603766e

Please sign in to comment.