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

STIL - ignore include statements, in-line loop comments, #208

Closed
wants to merge 32 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
cb818d4
More info from current command. Add dummy Plugin class to be built ou…
Aug 14, 2024
b54e88e
Merge remote-tracking branch 'origin/master' into corey_dev
Aug 14, 2024
bec2619
Merge remote-tracking branch 'origin/master' into corey_dev
Aug 15, 2024
7dbe42c
Move GH stuff under revision control. Some typo fixes in README. Add …
Aug 18, 2024
3ee296c
Try adding some retries for commonly failed steps. Debug regressions …
Aug 18, 2024
177f79f
Try undoing a debug step
Aug 18, 2024
88bcb6e
More debug for is_gh_regressions
Aug 19, 2024
76b37fd
More debug for is_gh_regressions
Aug 19, 2024
0c7163b
Try adding retries to LDAP tests
Aug 20, 2024
f97ea08
Update deps for LDAP retries
Aug 20, 2024
593db0f
Try compiling binaries
Aug 20, 2024
7495778
Publish Work
Aug 20, 2024
dff60a7
Publish WiP
Aug 20, 2024
33e1dff
Publishing WiP
Aug 20, 2024
82629e7
Delete rust/pyapi_metal/pyproject.toml
coreyeng Aug 20, 2024
ab90216
WiP Publishing
Aug 20, 2024
fa30672
WiP Publishing
Aug 20, 2024
f875c2d
Revert publish step
Aug 21, 2024
6cd287b
WiP Debug
Aug 21, 2024
53cf254
Publish Debug
Aug 21, 2024
77f3c42
Publishing WiP
Aug 21, 2024
1f475df
Add Perl-IPC-Cmd for Rust SSL crate build
Aug 21, 2024
cc10767
WiP Debug
Aug 21, 2024
1c57388
WiP Publishing
Aug 21, 2024
f0592a9
WiP Publishing
Aug 23, 2024
3028f51
WiP Publishing
Aug 23, 2024
560cb41
WiP Publishing
Aug 23, 2024
d878a1e
WiP Publishing
Aug 23, 2024
4f8ae75
WiP Publishing
Aug 23, 2024
36b1fa5
New function to parse STIL but skips any include statements.
rlaj Oct 2, 2024
37a96af
Loop comments to be child of loop node
rlaj Oct 3, 2024
01c28d4
Merge remote-tracking branch 'origin/master' into feature/stil_ignore…
rlaj Oct 4, 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
818 changes: 393 additions & 425 deletions .github/workflows/publish.yml

Large diffs are not rendered by default.

11 changes: 8 additions & 3 deletions .github/workflows/regression_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,8 @@ jobs:
- name: Setup No-App Env
uses: Wandalen/wretry.action@v1.3.0
with:
attempt_limit: 2
attempt_limit: 3
attempt_delay: 10000 # ms = 10 seconds
current_path: test_apps/python_no_app
command: poetry install

Expand Down Expand Up @@ -317,8 +318,12 @@ jobs:
# Issue being that working on a newer Python version than what's released will not resolve
# Workaround by removing origen_metal package from origen dependencies and installing separately
- name: Hack origen pyproject
working-directory: python/origen
run: poetry remove origen_metal
uses: Wandalen/wretry.action@v1.3.0
with:
attempt_limit: 3
attempt_delay: 10000 # ms = 10 seconds
current_path: python/origen
command: poetry remove origen_metal

- name: Install Origen Packages
run: |
Expand Down
2 changes: 2 additions & 0 deletions python/origen/origen/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ def __getattr__(name: str):
return origen._plugins
else:
return _plugins
elif name == "output_directory" or name == "output_dir":
return _origen.output_directory()
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")

# Replace origen_metal's native _origen_metal built library
Expand Down
10 changes: 9 additions & 1 deletion python/origen/origen/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def commands_dir(self):
return None

@property
def session(self):
def app_session(self):
''' Return this app's session store'''
return origen.sessions.app_session(self)

Expand All @@ -103,6 +103,14 @@ def user_session(self):
''' Return this app's user session store'''
return origen.sessions.user_session(self)

@property
def session(self):
''' If in an application workspace, return the this app's app session, otherwise this app's user session'''
if origen.app:
return self.app_session
else:
return self.user_session

@property
def rc(self):
return origen_metal.frontend.frontend().revision_control
Expand Down
46 changes: 32 additions & 14 deletions python/origen/origen/boot.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ def run_cmd(command,
--------
* :link-to:`Example Application Commands <src_code:example_commands>`
'''

import origen
import _origen
import origen_metal
Expand All @@ -47,13 +46,13 @@ def run_cmd(command,
arg_indices = {}

if command == dispatch_plugin_cmd:
cmd_src = "plugin"
cmd_src = _origen.current_command.SourceType.Plugin
elif command == dispatch_aux_cmd:
cmd_src = "aux_ns"
cmd_src = _origen.current_command.SourceType.Aux
elif command == dispatch_app_cmd:
cmd_src = "app"
cmd_src = _origen.current_command.SourceType.App
else:
cmd_src = "core"
cmd_src = _origen.current_command.SourceType.Core
dispatch = {}

def wrap_mod_from_file(path):
Expand All @@ -62,7 +61,7 @@ def wrap_mod_from_file(path):
except Exception as e:
return [path, e]

def mod_from_modulized_path(root, sub_parts):
def find_mod(root, sub_parts):
root = pathlib.Path(root)
if not root.exists():
return [f"Root directory '{root}' does not exists or is not accessible"]
Expand All @@ -76,23 +75,30 @@ def mod_from_modulized_path(root, sub_parts):
if modulized_path.exists():
path = pathlib.Path(f"{modulized_path}/{'.'.join(sub_parts[(i+1):])}.py")
if path.exists():
return wrap_mod_from_file(path)
return path
else:
paths.append(path)
else:
return [f"From root '{root}', searched:", *[p.relative_to(root) for p in paths]]
return [f"From root '{root}', searched:", *[p.relative_to(root) for p in paths]]
else:
return [f"From root '{root}', searched:", *[p.relative_to(root) for p in paths]]
return wrap_mod_from_file(path)
return path

def mod_from_modulized_path(root, sub_parts):
m = find_mod(root, sub_parts)
if isinstance(m, list):
return m
return wrap_mod_from_file(m)

def call_user_cmd(cmd_type):
m = mod_from_modulized_path(dispatch_root, subcmds)

if isinstance(m, list):
if isinstance(m[1], Exception):
origen.log.error(f"Could not load {cmd_type} command implementation from '{('.').join(subcmds)}' ({m[0]})")
origen.log.error(f"Received exception:\n{m[1]}")
import traceback
origen.log.error(f"Received exception:\n{''.join(traceback.format_exception(m[1]))}")
else:
origen.log.error(f"Could not find implementation for {cmd_type} command '{('.').join(subcmds)}'")
for msg in m:
Expand Down Expand Up @@ -182,13 +188,13 @@ def run(func):

for ext in extensions:
current_ext = ext
if cmd_src == "core":
if cmd_src.is_core_cmd:
_dispatch_src = [command]
elif cmd_src == "app":
elif cmd_src.is_app_cmd:
_dispatch_src = []
else:
_dispatch_src = [dispatch_src]
m = mod_from_modulized_path(ext['root'], [cmd_src, *_dispatch_src, *subcmds])
m = mod_from_modulized_path(ext['root'], [cmd_src.root_name, *_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]})")
Expand All @@ -208,7 +214,20 @@ def run(func):
if "on_load" in ext:
getattr((ext["mod"]), ext["on_load"])(ext["mod"])
current_ext = None
_origen.current_command.set_command(command, subcmds, args, ext_args, arg_indices, ext_arg_indices, extensions)
if cmd_src.is_core_cmd:
_origen.current_command.set_command(command, subcmds, args, ext_args, arg_indices, ext_arg_indices, extensions, cmd_src, None, None)
else:
path = find_mod(dispatch_root, subcmds)
if isinstance(path, list):
if isinstance(path[1], Exception):
origen.log.error(f"Could not load {cmd_src} command implementation from '{('.').join(subcmds)}' ({path[0]})")
origen.log.error(f"Received exception:\n{path[1]}")
else:
origen.log.error(f"Could not find implementation for {cmd_src} command '{('.').join(subcmds)}'")
for msg in path:
origen.log.error(f" {msg}")
exit_proc(1)
_origen.current_command.set_command(command, subcmds, args, ext_args, arg_indices, ext_arg_indices, extensions, cmd_src, path, dispatch_src)

def run_ext(phase, continue_on_fail=False):
for ext in extensions:
Expand Down Expand Up @@ -416,7 +435,6 @@ def tabify(message):
print("Error")
print(tabify(repr(e)))


elif command == dispatch_app_cmd:
call_user_cmd("app")

Expand Down
6 changes: 5 additions & 1 deletion python/origen/origen/core/plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ def from_origen_cli(plugins):
origen._plugins = pls
return origen._plugins

class Plugin:
pass

class Plugins(UserDict):
def __init__(self):
UserDict.__init__(self)
Expand All @@ -33,7 +36,8 @@ def names(self):

def register(self, name):
a = importlib.import_module(f'{name}.application')
app = a.Application(root=Path(os.path.abspath(
a_pl = type("Application", (Plugin, a.Application), {})
app = a_pl(root=Path(os.path.abspath(
a.__file__)).parent.parent,
name=name)
self.data[name] = app
Expand Down
2 changes: 1 addition & 1 deletion python/origen/origen/utility/github.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import _origen

dispatch_workflow = _origen.utility.dispatch_workflow
dispatch_workflow = _origen.utility.revision_control.github.dispatch_workflow
104 changes: 38 additions & 66 deletions python/origen_metal/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions python/origen_metal/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ dependencies = [
]

[tool.poetry.dev-dependencies]
pytest = "^6.2.4"
pytest = "^7"
pytest-rerunfailures = "13.0" # Last version that supports Python 3.7
pdoc = "^7"
maturin = "1.7.0"

Expand All @@ -45,10 +46,9 @@ markers = [
"ldap: marks tests requiring/using the external ldap",
]

# SMcG - Commented out, breaks regression (setting up test/python_app env)
#[tool.poetry.build]
#script = "poetry_build.py"
#generate-setup-file = false
[tool.poetry.build]
script = "poetry_build.py"
generate-setup-file = false

[tool.maturin]
module-name = "origen_metal._origen_metal"
Expand Down
Loading
Loading