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

Merge master into branch #198

Closed
wants to merge 214 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
214 commits
Select commit Hold shift + click to select a range
83038d6
Massive undergoing for command integration and the global invocation.
coreyeng Dec 27, 2022
e82fd31
Fix to see if regressions will work.
coreyeng Dec 28, 2022
49d2c67
Realized settrue arg action sets a default.
coreyeng Dec 28, 2022
d918357
Add no-app unit tests
coreyeng Dec 28, 2022
0fcd539
Use poetry directly in no-app tests
coreyeng Dec 28, 2022
130ccf8
More tries at no-app tests
coreyeng Dec 28, 2022
fe10d11
Try updated lockfile
coreyeng Dec 28, 2022
87f2c58
Updates for Linux/Python 3.8-
Dec 30, 2022
d945b0e
regression debug
coreyeng Dec 30, 2022
f7bce36
regressions debug
coreyeng Dec 30, 2022
a3298eb
Attempt python 3.7 fix. Some minor cleanup.
Dec 31, 2022
67cbe8f
Merge remote-tracking branch 'refs/remotes/origin/metal_integration' …
Dec 31, 2022
2d25f5e
Add user setting to disable password prompt. Add some simple tests. M…
Dec 31, 2022
a383344
Some clean up and refactoring
Jan 1, 2023
84da497
Add core_app. Continued clean up.
Jan 3, 2023
6f10098
Fix reserved windows path.
Jan 3, 2023
143aed9
Continue cleanup and add more tests.
Jan 17, 2023
0fc4efa
Add support for target, no target, and mode opts for custom commands …
Jan 29, 2023
fc6d23e
Merge remote-tracking branch 'origin/master' into metal_integration
Jan 29, 2023
cb957ae
use target command as guinea pig for a non-frontend command. Add stru…
Feb 13, 2023
66264f1
Make 'all targets' deterministic. Remove some debug statements. Add a…
Feb 13, 2023
5543e54
Allow assert present to receive str or list of strs.
Feb 13, 2023
716cc7d
Support app opts i n plugin/aux commands. Support disabling. Add test…
Feb 16, 2023
5a51c3b
Forgot a file
Feb 16, 2023
208bb22
Handle inter and intra opt exts. Add many tests but still some placeh…
Mar 30, 2023
91b8cb2
Prototype non-extendable commands. Redo boot sequence for more consis…
Apr 26, 2023
904c0bf
debug regression fails
Apr 26, 2023
7ec5593
continue regression debug
Apr 27, 2023
4a8df7d
Refactor and update non-extendable for plugins/plugin/aux_cmds/app-co…
May 11, 2023
a813bf9
See if updating locks and rust version resolves plugin order checking.
May 11, 2023
691461d
Remove checking order from app plugins. Doesn't seem to match between…
May 12, 2023
9785118
Merge remote-tracking branch 'origin/master' into metal_integration
May 12, 2023
723221e
Move generate and env commands to use shared methods. Add some basic …
May 16, 2023
f4d411e
add cargo.lock from merge
May 16, 2023
dfe3dbf
Attempt to fix windows regressions.
May 16, 2023
e9b81bc
Fix for windows
coreyeng May 17, 2023
4eb0c26
Start cleanup and remove untested commands
May 18, 2023
8615871
Refactor build/fmt as develop_origen subcmds. Update regressions acco…
May 19, 2023
617e114
Clean up last of CLI warnings. Remove app commands that haven't been …
May 20, 2023
b5c3084
Some cleanup & support splitting out core cmds from boot.py
May 22, 2023
d286688
Continue clean up. Bugfix where parent required args are inherited by…
May 24, 2023
ef489a1
Continue cleanup items
May 26, 2023
19a4625
Continue cmds PR cleanup and additional tests
May 29, 2023
1b06a8d
Try to fix path difference on Windows regressions.
coreyeng May 29, 2023
f2262ba
Continue cleanup or dispositining tasks
Jun 1, 2023
aff9521
Continue cleanup & re-categorizing future TODOs/tests
Jun 4, 2023
ee67a10
Finish up recategorizing cleanup items
Jun 4, 2023
fac50eb
Merge pull request #190 from Origen-SDK/metal_integration
coreyeng Jun 11, 2023
d4d9225
Begin invocation debug/test work. Add infrastructure and some tests f…
Jun 24, 2023
1dcce4c
Add missing checkin
Jun 24, 2023
ae15f17
Debugging regressions
Jun 25, 2023
03f2d35
Add jinja2 install
Jun 25, 2023
17e26e6
Fix pip install in actions yml
Jun 25, 2023
8700aeb
Try re-lock of user install invocation.
Jun 25, 2023
2794bd2
Debug tests on GA
Jun 25, 2023
2e0bbc1
(GA) Remove poetry update before OM tests
Jun 25, 2023
cffef7c
GA debug - unordered PL compare
Jun 26, 2023
6f0b72a
Add pytest rewrite for t_invocation_env in no_workspace
Jun 26, 2023
6e6f8b6
(GA Debug) Local env. was stale.
Jun 26, 2023
5213de7
Have eval cmd support running from script files.
Jul 1, 2023
6784940
Set indices to empty-dict if not given. Add test for arg indices. Fix…
Jul 2, 2023
c4d6287
Support auto-interpreting some args as strs in run_cli_cmd
Jul 2, 2023
69242fa
Fix for windows path conversion with given as arg to run_cli_cmd
coreyeng Jul 3, 2023
a9200fb
Accidentally left in some debug stuff
coreyeng Jul 3, 2023
62cabad
Add no-workspace with/without plugins tests
Jul 4, 2023
8889c54
Debug regression tests
Jul 4, 2023
55c8b27
GA: fix multiple run steps
Jul 4, 2023
2dcfcdb
GA: More debug
Jul 4, 2023
8c47254
GA: More debug
Jul 4, 2023
013db4f
GA: More debug
Jul 4, 2023
0f16b7f
GA: Continued Debug
Jul 5, 2023
22c7f7c
Update from cli-loc to cli-dir in invocation tests
Jul 5, 2023
ba98475
GA: Continued Debug
Jul 5, 2023
2a1f0e1
GA: Continued Debug
Jul 5, 2023
1026840
GA: Continued Debug
Jul 5, 2023
be43620
GA: Continued Debug
Jul 5, 2023
9c57296
GA: Continued Debug
Jul 5, 2023
d5dcdb3
Add global workspace tests
Jul 6, 2023
ff92557
Merge remote-tracking branch 'origin/master' into invocations
Jul 6, 2023
716ce8c
GA: Continued Debug
Jul 6, 2023
62b82b7
GA: Continued Debug
Jul 7, 2023
34051fe
GA: Continued Debug
Jul 7, 2023
a4a95a5
GA: Continued Debug
Jul 7, 2023
2509ae4
GA: Continued Debug
Jul 7, 2023
2685b45
GA: Continued Debug
Jul 7, 2023
3c6e385
GA: Continued Debug
Jul 7, 2023
dd92cf8
Continued GA Debug
Jul 8, 2023
8d885d3
GA: Continued Debug
Jul 8, 2023
d1c471d
GA: Continued Debug
Jul 8, 2023
d54344e
Some cleanup and add some context for Windows issue in GA
Jul 8, 2023
989d4e1
Minor cleanup
Jul 9, 2023
5fd1692
Add some error cases that may fall back to a global install
Jul 11, 2023
8664443
GA: Debug
Jul 11, 2023
97b369c
GA: Debug
Jul 11, 2023
5fec106
GA: Debug
Jul 11, 2023
a6fd4b0
See about moving Python version to repo variable
Jul 12, 2023
1b0bc2d
Move more into repo variables
Jul 12, 2023
367ec1a
Try new rust install as current one causes deprecation warnings and a…
Jul 12, 2023
3658eb4
GA: Debug New Rust Setup
Jul 12, 2023
70369bd
GA: Debug & Update checkout version
Jul 13, 2023
313fe40
Merge pull request #191 from Origen-SDK/invocations
coreyeng Jul 15, 2023
cb28b99
Update to pyo3 17.3
Jul 16, 2023
4798684
Clean up pyo3 17.3 warnings. Fix run_cmd calls in examples
Jul 17, 2023
6055900
Bump to pyo3 18.0
Jul 19, 2023
76aee8b
Update to pyo3 19.1 (latest as of now)
Jul 19, 2023
de5364b
Update pyprojects to support up to 3.12. add script to make this easi…
Jul 24, 2023
000eb66
Try bumping pip version for python 3.12
Jul 25, 2023
bde62f0
GA: Test for for python 3.12
Jul 25, 2023
cda1eaf
Merge remote-tracking branch 'origin/master' into python_3.11_support
Jul 26, 2023
8520c30
Merge pull request #192 from Origen-SDK/python_3.11_support
coreyeng Jul 26, 2023
6e97944
Support later rust
Aug 2, 2023
8cabadd
Support stable rust
coreyeng Aug 5, 2023
2ffa013
Merge pull request #193 from Origen-SDK/rust_update
coreyeng Aug 9, 2023
e897f1f
Support generating a new workspace (not full app, just workspace). So…
Oct 18, 2023
0973471
Attempt: Fix regression tests
coreyeng Oct 20, 2023
e4b0e6a
Support workflow dispatch for regressions
coreyeng Oct 21, 2023
be773b7
Add readme for no-workspace regressions
coreyeng Oct 22, 2023
6f852de
Update README.md
coreyeng Oct 22, 2023
02bdfd3
Merge pull request #195 from Origen-SDK/origen_new
coreyeng Oct 22, 2023
25021b8
WIP: publish action
Nov 4, 2023
763abef
(origen/OM publishing) Add check for when full publishing script shou…
Nov 5, 2023
ebc3dd8
WiP: publishing
Nov 5, 2023
910636c
WiP: publishing
Nov 5, 2023
ad9e0e4
WiP: publishing
Nov 5, 2023
14e9b2c
WiP: publishing
Nov 6, 2023
fbb26b0
WiP: publishing
Nov 6, 2023
698ef93
Robustness/usage fixes for 'run_origen' poetry wrapper
Nov 7, 2023
4b84cd7
Debug: Robustness/usage fixes for 'run_origen' poetry wrapper
coreyeng Nov 7, 2023
bed413e
Debug: Robustness/usage fixes for 'run_origen' poetry wrapper
coreyeng Nov 8, 2023
17f0dca
Debug: Try reverting run cmd for Linux.
coreyeng Nov 8, 2023
38d10a7
Try removing _origen copy step
coreyeng Nov 9, 2023
4eb3782
Add copy step back. Slight reorder of no-app check to after CLI manip…
coreyeng Nov 9, 2023
0def459
Retry robustness update in run_origen
coreyeng Nov 9, 2023
dc4ba22
Try using poetry's wrapper for regressions.
coreyeng Nov 9, 2023
fd621b9
Copy origen binary, imitating full build step
coreyeng Nov 9, 2023
a831575
Update CLI dirs.
coreyeng Nov 12, 2023
9af9274
Try moving origen CLI earlier
coreyeng Nov 12, 2023
1585119
Move user install tests to after global origen install
coreyeng Nov 13, 2023
c458a1a
Regressions debug
coreyeng Nov 13, 2023
6e5bbfc
Regressions debug
coreyeng Nov 13, 2023
ff8907b
WiP: Github release during publish
Nov 13, 2023
c6cacf8
Merge remote-tracking branch 'origin/master'
Nov 13, 2023
e165ee2
Fix GH release condition
Nov 13, 2023
9eef87f
Try adding a checkout to see if the github release action picks up gi…
Nov 13, 2023
b41ca4c
Try adding commit to release
Nov 13, 2023
6078384
Try adding commit-based tag.
Nov 14, 2023
c9f05d7
WiP: Publish GH Release
Nov 14, 2023
85b7fbd
WiP: GH Release. Zip wheels for release upload.
Nov 14, 2023
7418339
Add commit preface to tag. Bump upload artifact version
Nov 15, 2023
14a1254
Clean up dead code in regressions. Run metal tests across python vers…
coreyeng Nov 15, 2023
9ef28f8
Fix commit tag during GH release. Add boolean options
Nov 15, 2023
a5c12be
Merge pull request #196 from Origen-SDK/cli_and_tests_debug
coreyeng Nov 15, 2023
eef3d78
Prototype using 'retry' action for finicky steps
coreyeng Nov 15, 2023
330b709
WiP: Start larger publishing effort
Nov 17, 2023
586b042
Merge remote-tracking branch 'origin/master'
Nov 17, 2023
581515e
Publishing: bugfix in GH release. Try not validating wheel metadata
Nov 18, 2023
96210d2
Publishing: Debug action
Nov 18, 2023
dc9b5f3
Publishing: Try just releasing origen to test server. Debug getting i…
Nov 18, 2023
f768b78
Publishing: WiP
Nov 18, 2023
0c442fa
WiP O2 Publishing: Bump git2 version. Support getting/increment versi…
Dec 9, 2023
35bcaab
Support any Python 3.12 version
Dec 10, 2023
323344e
Update python versions again. Change script to non-inclusive max.
Dec 10, 2023
e4db777
Update lock file for new python
Dec 10, 2023
c64eca1
Resume WiP on publishing action
Dec 10, 2023
8ea05f1
Add OM test server publishing token
Dec 10, 2023
318c370
WiP: Debug publishing
Dec 10, 2023
a49061e
WiP: Publishing: Bugfix for GH release
Dec 10, 2023
b40239b
WiP: PublishingO2: Bump OM/Origen versions. Some scripting to assist …
Dec 11, 2023
9536b90
WiP: Publishing: Add pypi job. Add verbose setting to pypi uploads
Dec 11, 2023
1c45418
WiP: Publishing: Ensure cleanup after release to pypi
Dec 11, 2023
03e4a36
WiP: Publishing: Fix some typos
Dec 11, 2023
2ecb0a8
Experiment with publish checks in publish action
Jan 9, 2024
15b3f10
WiP: Publishing Checks
Jan 10, 2024
6eb2c4e
WiP: Publishing Checks
Jan 10, 2024
af6ad8a
WiP: Publishing Checks: Try updating lock_master job permissions.
Jan 11, 2024
8c2eb0f
WiP: Publishing: Experiment with Docker image for manylinux
Jan 13, 2024
489d2c5
WiP: Publishing Manylinux
Jan 13, 2024
a406070
WiP: Publishing Manylinux
Jan 13, 2024
a2df131
WiP: Publishing Manylinux
Jan 13, 2024
5500ecb
WiP: Publishing, try manylinux2014 image
Jan 13, 2024
66ddea8
WiP: Publishing: Momentarily skip Rust install
Jan 13, 2024
701a1e5
WiP: Publishing: Actually try rust skip
Jan 13, 2024
e4bab83
WiP: Publishing: manylinux
Jan 16, 2024
78fb3a8
WiP: Publishing: manylinux
Jan 17, 2024
56fcb19
WiP: Publishing: manylinux
Jan 17, 2024
8199c5c
WiP: Publishing manylinux
Jan 20, 2024
f6f4bf7
WiP: Publishing. Revert windows release to same versions as regressio…
Jan 20, 2024
621fba4
WiP: Publishing manylinux. Bugfix for python URL
Jan 20, 2024
852310f
WiP: Publishing manylinux
Jan 21, 2024
e4ea98f
WiP: Publishing manylinux
Jan 21, 2024
81f6c82
WiP: Publishing manylinux
Jan 21, 2024
96c916e
WiP: Publishing manylinux
Jan 21, 2024
ed98e7e
WiP: Publishing manylinux
Jan 21, 2024
578f3f1
WiP: Publishing manylinux
Jan 21, 2024
243bded
Move version wrapper to OM. Add some version tests. Support version f…
Feb 1, 2024
44f1db9
Debug regressions
Feb 2, 2024
be52e43
Add equivalent origen version support from OM. Bump origen version to…
Feb 6, 2024
aa81da3
Bump Origen version. Add consistency to user-facing versions. Change …
Feb 15, 2024
9c694c7
Try reinstalling poetry globally for windows regressions
Feb 17, 2024
40f85ce
Fix Cargo.toml capitalization
coreyeng Feb 17, 2024
1993564
Add additional poetry/pip version outputs. Try poetry install from ENV.
Feb 17, 2024
f5582f6
Merge remote-tracking branch 'origin/master'
Feb 17, 2024
3df6dd0
Fix caching poetry version
Feb 17, 2024
f0c671c
WIP: Debug Regressions
Feb 18, 2024
ad5e173
Debug Regressions: Try reverting build system
Feb 18, 2024
07a2f49
Add CLI to github releases. Bypass regressions for just version and p…
Mar 3, 2024
4d02b4a
Try to fix regression test paths-ignore error
Mar 5, 2024
ea36b3f
Try to fix regression test ignore-paths
Mar 5, 2024
f2cbc9f
Build out publish command some. Remove locking master from publish wo…
Mar 11, 2024
b647ef1
Updated version files for next release
Mar 17, 2024
600cc85
Continue work on publish command.
Mar 17, 2024
f24848b
Try regression fix. Add additional version support. Add some version …
Mar 18, 2024
5c321a6
Expose some more version features to frontend. Add tests.
Mar 19, 2024
de4bd47
Fix OM test needing FE for less-robust Windows
Mar 19, 2024
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
Prev Previous commit
Next Next commit
Handle inter and intra opt exts. Add many tests but still some placeh…
…olders. Add some intra-cmd cases as well.
  • Loading branch information
Corey committed Mar 30, 2023
commit 208bb226937111964d711cbe780bf4dca4e1d0f5
16 changes: 12 additions & 4 deletions python/origen/origen/boot.py
Original file line number Diff line number Diff line change
@@ -197,13 +197,23 @@ def run(func):

for ext in extensions:
current_ext = ext
m = mod_from_modulized_path(ext['root'], [cmd_src, command if cmd_src == "core" else dispatch_src, *subcmds])
if cmd_src == "core":
_dispatch_src = [command]
elif cmd_src == "app":
_dispatch_src = []
else:
_dispatch_src = [dispatch_src]
m = mod_from_modulized_path(ext['root'], [cmd_src, *_dispatch_src, *subcmds])
if isinstance(m, list):
if len(m) == 2 and isinstance(m[1], Exception):
origen.log.error(f"Could not load {ext['source']} extension implementation from '{ext['name']}' ({m[0]})")
origen.log.error(f"Received exception:\n{m[1]}")
else:
origen.log.error(f"Could not find implementation for {ext['source']} extension '{ext['name']}'")
if ext['source'] == "app":
n = ''
else:
n = f"'{ext['name']}'"
origen.log.error(f"Could not find implementation for {ext['source']} extension{n}")
for msg in m:
origen.log.error(f" {msg}")
ext['mod'] = None
@@ -460,8 +470,6 @@ def tabify(message):


elif command == dispatch_app_cmd:
# FOR_PR fix this upstream
subcmds = subcmds[1:]
call_user_cmd("app")

elif command == dispatch_plugin_cmd:
42 changes: 40 additions & 2 deletions python/origen/origen/helpers/regressions/cli/command.py
Original file line number Diff line number Diff line change
@@ -23,6 +23,9 @@ def __init__(
self.required = required
self.value_name = value_name
self.use_delimiter = use_delimiter
self.is_ext = False
self.is_opt = False
self.is_arg = True

class CmdOpt(CmdArgOpt):
def __init__(
@@ -38,7 +41,9 @@ def __init__(
ln_aliases=None,
value_name=None,
hidden = False,
use_delimiter=None
use_delimiter=None,
full_name=None,
access_with_full_name=False,
):
self.name = name
self.help = help
@@ -52,9 +57,17 @@ def __init__(
self.value_name = value_name
self.hidden = hidden
self.use_delimiter = use_delimiter
self.full_name = full_name
self.access_with_full_name = access_with_full_name
self.is_ext = False
self.is_opt = True
self.is_arg = False

def to_ln(self):
return self.ln or self.name
if self.access_with_full_name:
return self.full_name
else:
return self.ln or self.name

def ln_to_cli(self):
return f"--{self.to_ln()}"
@@ -77,16 +90,32 @@ class SrcTypes(enum.Enum):
PLUGIN = enum.auto()
AUX = enum.auto()

def __str__(self) -> str:
if self == self.CORE:
return "origen"
elif self == self.APP:
return "app"
elif self == self.PLUGIN:
return "plugin"
elif self == self.AUX:
return "aux"

class CmdExtOpt(CmdOpt):
@classmethod
def from_src(cls, src_name, src_type, *args):
for a in args:
a.src_name = src_name
a.src_type = src_type
if src_type == SrcTypes.APP:
src_n = ""
else:
src_n = f".{src_name}"
a.full_name = f"ext_opt.{src_type}{src_n}.{a.name}"
return args

def __init__(self, *args, src_name=None, src_type=None, **kwargs):
CmdOpt.__init__(self, *args, **kwargs)
self.is_ext = True
self.src_name = src_name
self.src_type = src_type

@@ -101,6 +130,15 @@ def provided_by(self):
else:
return self.src_name

@property
def displayed(self):
if self.provided_by_app:
return "the App"
elif self.src_type == SrcTypes.PLUGIN:
return f"plugin '{self.src_name}'"
elif self.src_type == SrcTypes.AUX:
return f"aux namespace '{self.src_name}'"

class CmdDemo:
def __init__(self, name, args=None, expected_output=None) -> None:
self.name = name
6 changes: 5 additions & 1 deletion python/origen/origen/helpers/regressions/cli/help_msg.py
Original file line number Diff line number Diff line change
@@ -418,4 +418,8 @@ def assert_targets_opt_at(self, expected_index):

def assert_summary(self, msg):
assert self.help == msg
return True
return True

@property
def logged_errors(self):
return list(filter(lambda l: "[ERROR] (" in l, self.text.split("\n")))
66 changes: 62 additions & 4 deletions python/origen/origen/helpers/regressions/cli/origen.py
Original file line number Diff line number Diff line change
@@ -54,12 +54,66 @@ def eval_cmd(cls, add_opts=None):
]
)

@classmethod
def creds_cmd(cls, add_opts=None):
return Cmd(
cls.creds,
help="Set or clear user credentials",
subcmds=[
Cmd(
"set",
help="Set the current user's password",
opts=(add_opts or []) + [
CmdOpt(
"all",
help="Set the password for all datasets",
ln="all",
sn="a",
takes_value=False,
required=False,
),
CmdOpt(
"datasets",
help="Specify the dataset to set the password for",
ln="datasets",
sn="d",
multi=True,
required=False,
),
]
),
Cmd(
"clear",
help="Clear the user's password",
opts=(add_opts or []) + [
CmdOpt(
"all",
help="Clear the password for all datasets",
ln="all",
sn="a",
takes_value=False,
required=False,
),
CmdOpt(
"datasets",
help="Specify the dataset to clear the password for",
ln="datasets",
sn="d",
multi=True,
required=False,
),
]
)
]
)

@classmethod
def interactive_cmd(cls, add_opts=None):
return Cmd(
cls.i,
help="Start an Origen console to interact with the DUT",
aliases=['i'],
opts=add_opts,
)

@classmethod
@@ -113,7 +167,7 @@ class Names:
pl = Cmd(names.pl)
proj = Cmd(names.proj)
new = Cmd(names.new)
creds = Cmd(names.creds)
creds = _CommonNames.creds_cmd()
i = _CommonNames.interactive_cmd()
fmt = Cmd(names.fmt)
build = Cmd(names.build)
@@ -215,7 +269,7 @@ def targets_arg(cls, help):
aux_cmds = Cmd(names.aux_cmds)
build = Cmd(names.build)
compile = Cmd(names.compile)
creds = Cmd(names.creds)
creds = _CommonNames.creds_cmd(add_opts=in_app_opts.all())
env = Cmd(names.env)
eval = _CommonNames.eval_cmd(add_opts=in_app_opts.all())
exec = Cmd(names.exec)
@@ -318,6 +372,10 @@ def missing_required_arg(cls, *vals):
mapped_vals.append(f"<{v.to_vn()}>")
return "The following required arguments were not provided:" + "\n " + " \n".join(mapped_vals)

@classmethod
def cmd_building_err_prefix(cls, cmd):
return f"When processing command '{cmd.full_name}':"

@classmethod
def conflict_msg(cls, cmd, opt, conflict, conflict_type):
if conflict_type in ['long name', 'long name alias']:
@@ -326,9 +384,9 @@ def conflict_msg(cls, cmd, opt, conflict, conflict_type):
hyphens = "-"

if isinstance(opt, CmdExtOpt):
return f"Option '{opt.name}' extended from '{opt.provided_by}' for command '{cmd.full_name}' tried to use reserved option {conflict_type} '{conflict}' and will not be available as '{hyphens}{conflict}'"
return f"{cls.cmd_building_err_prefix(cmd)} Option '{opt.name}' extended from {opt.provided_by} tried to use reserved option {conflict_type} '{conflict}' and will not be available as '{hyphens}{conflict}'"
else:
return f"Option '{opt.name}' from command '{cmd.full_name}' tried to use reserved option {conflict_type} '{conflict}' and will not be available as '{hyphens}{conflict}'"
return f"{cls.cmd_building_err_prefix(cmd)} Option '{opt.name}' tried to use reserved option {conflict_type} '{conflict}' and will not be available as '{hyphens}{conflict}'"

@classmethod
def reserved_opt_ln_conflict_msg(cls, cmd, opt, conflict):
3 changes: 1 addition & 2 deletions rust/origen/cli/src/bin.rs
Original file line number Diff line number Diff line change
@@ -120,15 +120,14 @@ fn main() -> Result<()> {
let mut helps = CmdHelps::new();
let app_cmds: Option<AppCmds>;
let mut extensions = Extensions::new();
let aux_cmds = AuxCmds::new(&mut extensions)?;

let plugins = match Plugins::new(&mut extensions) {
Ok(pl) => pl,
Err(e) => {
log_error!("Failed to collect plugins. Encountered error: {}", e);
None
}
};
let aux_cmds = AuxCmds::new(&mut extensions)?;

if let Some(app) = &STATUS.app.as_ref() {
app_cmds = Some(AppCmds::new(app, &mut extensions)?);
15 changes: 4 additions & 11 deletions rust/origen/cli/src/commands/app.rs
Original file line number Diff line number Diff line change
@@ -189,30 +189,23 @@ pub(crate) fn run(cmd: &ArgMatches, mut app: &App, exts: &Extensions, plugins: O
}
"commands" => {
if let Some(subc) = cmd.subcommand() {
// FOR_PR clean up
// let ns_ins = aux_cmds.namespaces.get(subc.0).expect(&format!("Expected auxillary command namespace '{}' to be present, but was not found", subc.0));
let path = build_path(&cmd)?;

let mut overrides = IndexMap::new();

let mut matches = cmd;
let mut path_pieces: Vec<String> = vec!();
app = app.find_subcommand(BASE_CMD).unwrap();
// app = app.find_subcommand(subc.0).unwrap();
matches = matches.subcommand_matches("commands").unwrap();
app = app.find_subcommand("commands").unwrap();
while matches.subcommand_name().is_some() {
let n = matches.subcommand_name().unwrap();
matches = matches.subcommand_matches(&n).unwrap();
app = app.find_subcommand(n).unwrap();
// path_pieces.push(format!("r'{}'", n));
path_pieces.push(n.to_string());
}

// let mut cmd_def = get_cmd_def(cmd, app); // app.find_subcommand();
// TODO app isn't right here - needs to be subcommand
launch_as("_dispatch_app_cmd_", Some(&path_pieces), matches, app, exts.get_aux_ext(subc.0, &path), plugins, Some(
let path = path_pieces.join(".");
launch_as("_dispatch_app_cmd_", Some(&path_pieces), matches, app, exts.get_app_ext(&path), plugins, Some(
{
overrides.insert("dispatch_root".to_string(), Some(format!("r'{}'", app_cmds.cmds_root()?.display())));
// overrides.insert("dispatch_cmds".to_string(), Some(format!("[{}]", path_pieces.join(", "))));
overrides
}
), None);
22 changes: 16 additions & 6 deletions rust/origen/cli/src/commands/mod.rs
Original file line number Diff line number Diff line change
@@ -124,6 +124,16 @@ pub fn launch2(invocation: &ArgMatches, cmd_def: &App, cmd_exts: Option<&Vec<Ext
// }

pub fn launch3(base_cmd: Option<&str>, subcmds: Option<&Vec<String>>, invocation: &ArgMatches, cmd_def: &App, cmd_exts: Option<&Vec<Extension>>, plugins: Option<&Plugins>, overrides: Option<IndexMap<String, Option<String>>>, arg_overrides: Option<IndexMap<String, Option<String>>>) {
macro_rules! as_name {
($arg_name:expr) => {{
if $arg_name.starts_with(crate::framework::extensions::EXT_BASE_NAME) {
$arg_name.splitn(4, ".").last().unwrap()
} else {
$arg_name
}
}}
}

let mut args: Vec<String> = vec!();

// println!("exts from launch: {:?}", cmd_exts);
@@ -133,7 +143,7 @@ pub fn launch3(base_cmd: Option<&str>, subcmds: Option<&Vec<String>>, invocation
for ext in exts {
if let Some(opts) = ext.opts.as_ref() {
for opt in opts {
opt_names.insert(opt.name.as_str(), &ext.source);
opt_names.insert(opt.full_name.as_ref().unwrap().as_str(), &ext.source);
if !ext_args.contains_key(&ext.source) {
ext_args.insert(&ext.source, vec!());
}
@@ -172,30 +182,30 @@ pub fn launch3(base_cmd: Option<&str>, subcmds: Option<&Vec<String>>, invocation
if arg.is_multiple_values_set() {
// Give to Python as an array of string values
let r = invocation.get_many::<String>(arg_n).unwrap().map(|x| format!("\"{}\"", x)).collect::<Vec<String>>();
arg_str = format!("r'{}': [{}]", arg_n, r.join(", "));
arg_str = format!("r'{}': [{}]", as_name!(arg_n), r.join(", "));
} else {
// Give to Python a single string value
arg_str = format!("r'{}': r'{}'", arg_n, invocation.get_one::<String>(arg_n).unwrap());
arg_str = format!("r'{}': r'{}'", as_name!(arg_n), invocation.get_one::<String>(arg_n).unwrap());
}
} else {
match arg.get_action() {
SetArgTrue => {
if *(invocation.get_one::<bool>(arg_n).unwrap()) {
arg_str = format!("r'{}': True", arg_n);
arg_str = format!("r'{}': True", as_name!(arg_n));
} else {
continue;
}
},
CountArgs => {
let count = *(invocation.get_one::<u8>(arg_n).unwrap());
if count > 0 {
arg_str = format!("r'{}': {}", arg_n, count);
arg_str = format!("r'{}': {}", as_name!(arg_n), count);
} else {
continue;
}
},
_ => {
log_error!("Unsupported action '{:#?}' for arg '{}'", arg.get_action(), arg_n); //arg_str = format!("r'{}': True", arg_n)
log_error!("Unsupported action '{:#?}' for arg '{}'", arg.get_action(), as_name!(arg_n)); //arg_str = format!("r'{}': True", arg_n)
exit(1);
}
}
4 changes: 2 additions & 2 deletions rust/origen/cli/src/framework/app_cmds.rs
Original file line number Diff line number Diff line change
@@ -99,8 +99,8 @@ pub (crate) fn add_commands<'a>(app: App<'a>, helps: &'a CmdHelps, app_commands:
for top_cmd_name in app_commands.top_commands.iter() {
app_cmds_cmd = app_cmds_cmd.subcommand(build_commands(
&app_commands.commands.get(top_cmd_name).unwrap(),
&|cmd, app| {
exts.apply_to_app_cmd(cmd, app)
&|cmd, app, opt_cache| {
exts.apply_to_app_cmd(cmd, app, opt_cache)
},
&|cmd| {
app_commands.commands.get(cmd).unwrap()
4 changes: 2 additions & 2 deletions rust/origen/cli/src/framework/aux_cmds.rs
Original file line number Diff line number Diff line change
@@ -178,8 +178,8 @@ pub (crate) fn add_commands<'a>(app: App<'a>, helps: &'a CmdHelps, aux_commands:
for top_cmd_name in cmds.top_commands.iter() {
aux_sub_sub = aux_sub_sub.subcommand(build_commands(
&cmds.commands.get(top_cmd_name).unwrap(),
&|cmd, app| {
exts.apply_to_aux_cmd(&ns, cmd, app)
&|cmd, app, opt_cache| {
exts.apply_to_aux_cmd(&ns, cmd, app, opt_cache)
},
&|cmd| {
cmds.commands.get(cmd).unwrap()
Loading
Oops, something went wrong.