-
-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #58 from sbidoul/circular-deps-sbi
Handle circular dependencies between repos
- Loading branch information
Showing
4 changed files
with
95 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/bin/bash | ||
|
||
# | ||
# Print addons to test, comma separated. | ||
# Take INCLUDE and EXCLUDE variables into account. | ||
# Do not list addons that are not installable. | ||
# | ||
|
||
set -ex | ||
|
||
if [ -n "${INCLUDE}" ]; then | ||
ADDONS=$(manifestoo --select-include "${INCLUDE}" --select-exclude "${EXCLUDE}" list --separator=,) | ||
else | ||
ADDONS=$(manifestoo --select-addons-dir ${ADDONS_DIR} --select-exclude "${EXCLUDE}" list --separator=,) | ||
fi | ||
|
||
echo $ADDONS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
#!/usr/bin/env python | ||
|
||
# | ||
# Print addons to test as pip requirements pointing to local directories. | ||
# There is an option to make them editable or file URLs. | ||
# | ||
|
||
import argparse | ||
import os | ||
import subprocess | ||
from pathlib import Path | ||
|
||
|
||
def _make_addon_dist_name(name): | ||
odoo_series = int(os.getenv("ODOO_VERSION").partition(".")[0]) | ||
return "odoo{odoo_series}-addon-{name}".format( | ||
name=name, | ||
odoo_series=odoo_series if odoo_series < 15 else "", | ||
) | ||
|
||
|
||
def _make_addon_req(path, editable): | ||
addon_uri = path.resolve().as_uri() | ||
addon_dist_name = _make_addon_dist_name(path.name) | ||
if editable: | ||
return "-e {addon_uri}#egg={addon_dist_name}".format( | ||
addon_uri=addon_uri, addon_dist_name=addon_dist_name | ||
) | ||
return "{addon_dist_name} @ {addon_uri}".format( | ||
addon_dist_name=addon_dist_name, addon_uri=addon_uri | ||
) | ||
|
||
|
||
def _list_addons_to_test(): | ||
return ( | ||
subprocess.check_output(["oca_list_addons_to_test"], universal_newlines=True) | ||
.strip() | ||
.split(",") | ||
) | ||
|
||
|
||
parser = argparse.ArgumentParser() | ||
parser.add_argument( | ||
"--editable", | ||
action="store_true", | ||
help="Path to addons dir", | ||
) | ||
args = parser.parse_args() | ||
|
||
addons_dir = Path(os.getenv("ADDONS_DIR", ".")) | ||
for addon_name in _list_addons_to_test(): | ||
pyproject_path = addons_dir / addon_name / "pyproject.toml" | ||
if pyproject_path.exists(): | ||
print(_make_addon_req(pyproject_path.parent, args.editable)) | ||
else: | ||
setuppy_path = addons_dir / "setup" / addon_name / "setup.py" | ||
if setuppy_path.exists(): | ||
print(_make_addon_req(setuppy_path.parent, args.editable)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters