Compare commits
2 commits
stable
...
poc_relati
Author | SHA1 | Date | |
---|---|---|---|
|
56f252f588 | ||
|
a9ef90c04e |
6 changed files with 31 additions and 32 deletions
4
.github/workflows/checks.yml
vendored
4
.github/workflows/checks.yml
vendored
|
@ -13,12 +13,12 @@ jobs:
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
- name: Set up Python
|
- name: Set up Python
|
||||||
uses: actions/setup-python@v3
|
uses: actions/setup-python@v3
|
||||||
with:
|
with:
|
||||||
python-version: '3.11'
|
python-version: '3.x'
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
|
|
7
.github/workflows/publish.yml
vendored
7
.github/workflows/publish.yml
vendored
|
@ -20,14 +20,11 @@ jobs:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- uses: actions/checkout@v3
|
||||||
uses: actions/checkout@v3
|
|
||||||
|
|
||||||
- name: Set up Python
|
- name: Set up Python
|
||||||
uses: actions/setup-python@v3
|
uses: actions/setup-python@v3
|
||||||
with:
|
with:
|
||||||
python-version: '3.11'
|
python-version: '3.x'
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
python -m pip install --upgrade pip
|
python -m pip install --upgrade pip
|
||||||
|
|
|
@ -203,8 +203,6 @@ def build(
|
||||||
all = False
|
all = False
|
||||||
shell.mkdir(target.builddir)
|
shell.mkdir(target.builddir)
|
||||||
ninjaPath = os.path.join(target.builddir, "build.ninja")
|
ninjaPath = os.path.join(target.builddir, "build.ninja")
|
||||||
|
|
||||||
if not os.path.exists(ninjaPath):
|
|
||||||
with open(ninjaPath, "w") as f:
|
with open(ninjaPath, "w") as f:
|
||||||
gen(f, target, registry)
|
gen(f, target, registry)
|
||||||
|
|
||||||
|
@ -230,9 +228,10 @@ def build(
|
||||||
)
|
)
|
||||||
|
|
||||||
outs = list(map(lambda p: str(p.path), products))
|
outs = list(map(lambda p: str(p.path), products))
|
||||||
|
if all:
|
||||||
shell.exec("ninja", "-f", ninjaPath, *(outs if not all else []))
|
shell.exec("ninja", "-f", ninjaPath)
|
||||||
|
else:
|
||||||
|
shell.exec("ninja", "-f", ninjaPath, *outs)
|
||||||
return products
|
return products
|
||||||
|
|
||||||
|
|
||||||
|
@ -244,8 +243,8 @@ def buildCmd(args: cli.Args):
|
||||||
registry = model.Registry.use(args)
|
registry = model.Registry.use(args)
|
||||||
target = model.Target.use(args)
|
target = model.Target.use(args)
|
||||||
componentSpec = args.consumeArg()
|
componentSpec = args.consumeArg()
|
||||||
component = None
|
if componentSpec is None:
|
||||||
if componentSpec is not None:
|
raise RuntimeError("No component specified")
|
||||||
component = registry.lookup(componentSpec, model.Component)
|
component = registry.lookup(componentSpec, model.Component)
|
||||||
build(target, registry, component)[0]
|
build(target, registry, component)[0]
|
||||||
|
|
||||||
|
|
|
@ -71,7 +71,7 @@ class Manifest(DataClassJsonMixin):
|
||||||
"""
|
"""
|
||||||
Return the directory of the manifest
|
Return the directory of the manifest
|
||||||
"""
|
"""
|
||||||
return os.path.relpath(os.path.dirname(self.path), Path.cwd())
|
return os.path.dirname(self.path)
|
||||||
|
|
||||||
def subpath(self, path) -> Path:
|
def subpath(self, path) -> Path:
|
||||||
return Path(self.dirname()) / path
|
return Path(self.dirname()) / path
|
||||||
|
@ -121,18 +121,19 @@ class Project(Manifest):
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def ensure() -> "Project":
|
def ensure() -> "Project":
|
||||||
"""
|
|
||||||
Ensure that a project exists in the current directory or any parent directory
|
|
||||||
and chdir to the root of the project.
|
|
||||||
"""
|
|
||||||
project = Project.topmost()
|
project = Project.topmost()
|
||||||
if project is None:
|
if project is None:
|
||||||
raise RuntimeError(
|
raise RuntimeError(
|
||||||
"No project found in this directory or any parent directory"
|
"No project found in this directory or any parent directory"
|
||||||
)
|
)
|
||||||
os.chdir(project.dirname())
|
|
||||||
return project
|
return project
|
||||||
|
|
||||||
|
def chdir(self):
|
||||||
|
"""
|
||||||
|
Change the current working directory to the root of the project
|
||||||
|
"""
|
||||||
|
os.chdir(self.dirname())
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def at(path: Path) -> Optional["Project"]:
|
def at(path: Path) -> Optional["Project"]:
|
||||||
projectManifest = Manifest.tryLoad(path / "project")
|
projectManifest = Manifest.tryLoad(path / "project")
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import os
|
|
||||||
import logging
|
import logging
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
from . import shell, model, const
|
from . import shell, model, const
|
||||||
|
|
||||||
|
@ -17,6 +18,7 @@ def load(path: str):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
module = importlib.module_from_spec(spec)
|
module = importlib.module_from_spec(spec)
|
||||||
|
sys.modules["plugin"] = module
|
||||||
spec.loader.exec_module(module)
|
spec.loader.exec_module(module)
|
||||||
|
|
||||||
|
|
||||||
|
@ -33,11 +35,11 @@ def loadAll():
|
||||||
|
|
||||||
for dirname in paths:
|
for dirname in paths:
|
||||||
pluginDir = os.path.join(project.dirname(), dirname, const.META_DIR, "plugins")
|
pluginDir = os.path.join(project.dirname(), dirname, const.META_DIR, "plugins")
|
||||||
|
initFile = os.path.join(pluginDir, "__init__.py")
|
||||||
|
|
||||||
|
if os.path.isfile(initFile):
|
||||||
|
load(initFile)
|
||||||
|
else:
|
||||||
for files in shell.readdir(pluginDir):
|
for files in shell.readdir(pluginDir):
|
||||||
if files.endswith(".py"):
|
if files.endswith(".py"):
|
||||||
plugin = load(os.path.join(pluginDir, files))
|
load(os.path.join(pluginDir, files))
|
||||||
|
|
||||||
if plugin:
|
|
||||||
_logger.info(f"Loaded plugin {plugin.name}")
|
|
||||||
plugin.init()
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ authors = [
|
||||||
{ name = "Cute Engineering", email = "contact@cute.engineering" },
|
{ name = "Cute Engineering", email = "contact@cute.engineering" },
|
||||||
]
|
]
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
requires-python = ">=3.11"
|
requires-python = ">=3.10"
|
||||||
license = { text = "MIT" }
|
license = { text = "MIT" }
|
||||||
dynamic = ["version", "dependencies"]
|
dynamic = ["version", "dependencies"]
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue