-
Notifications
You must be signed in to change notification settings - Fork 6
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
Build tool update #79
Changes from 8 commits
7d8db1c
2563202
2832c95
e86008c
3c5ed9f
ca3b558
68585c1
8ac49fb
b3766cb
39ea8d5
5da413c
d246c8f
821c350
40b4769
c28ce3b
16b545c
b4ba8af
1a27857
a9d4095
2dce340
e204a50
3f82bda
7718db7
104bf19
63decef
b4d1a89
3a9e8b3
dee6286
6114d85
2a97a69
a9410f8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ | |
|
||
from Utils import run_cmd, run_cmds, run_cmd_capture_output | ||
from Utils import SUCCESS, FAILURE | ||
from release_tools import find_conda_activate | ||
from release_tools import prep_conda_env, check_if_conda_forge_pkg, clone_feedstock | ||
from release_tools import clone_repo, prepare_recipe_in_local_feedstock_repo | ||
from release_tools import copy_file_from_repo_recipe | ||
|
@@ -48,6 +49,8 @@ | |
# this script in CircleCI. | ||
# | ||
|
||
conda_rc = os.path.join(os.getcwd(), "condarc") | ||
|
||
parser = argparse.ArgumentParser( | ||
description='conda build upload', | ||
formatter_class=argparse.ArgumentDefaultsHelpFormatter) | ||
|
@@ -69,9 +72,17 @@ | |
parser.add_argument("--do_rerender", action='store_true', help="do 'conda smithy rerender'") | ||
parser.add_argument("--do_build", action='store_true', help="do 'conda build -m <variant file> ...'") | ||
parser.add_argument("--build_version", default="3.7", help="specify python version to build 2.7, 3.7, 3.8") | ||
parser.add_argument("--conda_env", default="base", help="Conda environment to use, will be created if it doesn't exist") | ||
parser.add_argument("--extra_channels", nargs="+", type=str, default=[]) | ||
parser.add_argument("--ignore_conda_missmatch", action="store_true", help="Will skip checking if packages are uptodate when rerendering recipe.") | ||
parser.add_argument("--conda_rc", default=conda_rc, help="File to use for condarc") | ||
parser.add_argument("--conda_activate", help="Path to conda activate script.") | ||
parser.add_argument("--copy_conda_package", help="Copies output conda package to directory") | ||
|
||
args = parser.parse_args(sys.argv[1:]) | ||
|
||
print(args) | ||
|
||
pkg_name = args.package_name | ||
branch = args.branch | ||
workdir = args.workdir | ||
|
@@ -86,6 +97,8 @@ | |
# github organization of projects | ||
organization = args.github_organization_name | ||
|
||
status = FAILURE | ||
|
||
# for calling run_cmds | ||
join_stderr = True | ||
shell_cmd = False | ||
|
@@ -108,13 +121,20 @@ def construct_pkg_ver(repo_dir, arg_version, arg_last_stable): | |
# main | ||
# | ||
|
||
kwargs = vars(args) | ||
kwargs["conda_activate"] = args.conda_activate or find_conda_activate() | ||
|
||
if kwargs["conda_activate"] is None: | ||
print("Could not find conda activate script, try passing with --conda_activate argument") | ||
sys.exit(FAILURE) | ||
|
||
is_conda_forge_pkg = check_if_conda_forge_pkg(pkg_name) | ||
|
||
if args.do_rerender: | ||
status = prep_conda_env() | ||
if status != SUCCESS: | ||
sys.exit(status) | ||
status = prep_conda_env(**kwargs) | ||
if status != SUCCESS: | ||
sys.exit(status) | ||
|
||
if args.do_rerender: | ||
ret, repo_dir = clone_repo(organization, repo_name, branch, workdir) | ||
if ret != SUCCESS: | ||
sys.exit(ret) | ||
|
@@ -143,10 +163,10 @@ def construct_pkg_ver(repo_dir, arg_version, arg_last_stable): | |
if status != SUCCESS: | ||
sys.exit(status) | ||
|
||
status = rerender_in_local_feedstock(pkg_name, workdir) | ||
status = rerender_in_local_feedstock(pkg_name=pkg_name, workdir=workdir, **kwargs) | ||
|
||
if args.do_build: | ||
status = build_in_local_feedstock(pkg_name, workdir, args.build_version) | ||
status = build_in_local_feedstock(pkg_name=pkg_name, workdir=workdir, py_version=args.build_version, **kwargs) | ||
|
||
else: | ||
# non conda-forge package (does not have feedstock) | ||
|
@@ -161,10 +181,10 @@ def construct_pkg_ver(repo_dir, arg_version, arg_last_stable): | |
if status != SUCCESS: | ||
sys.exit(status) | ||
|
||
status = rerender_in_local_repo(repo_dir) | ||
status = rerender_in_local_repo(repo_dir=repo_dir, **kwargs) | ||
|
||
if args.do_build: | ||
status = build_in_local_repo(repo_dir, args.build_version) | ||
status = build_in_local_repo(repo_dir=repo_dir, py_version=args.build_version, **kwargs) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This comments apply to both build_in_local_repo() and build_in_local_feedstock(). |
||
|
||
sys.exit(status) | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason I had clone_repo() here is because doing rerendering will overwrite .circleci/config.yml.
The repo will be cloned to /<repo_name>.
If I accidentally set to the parent directory of my repo where I ran Makefile from, clone_repo() will overwrite my repo.
so it is better to put a check somewhere that should not be the same as the parent directory of the repo where I ran 'make' from.