Skip to content

Commit

Permalink
Merge pull request #41 from siliconcompiler/better-python-helper
Browse files Browse the repository at this point in the history
use sc_package to register python information
  • Loading branch information
gadfort authored Feb 20, 2024
2 parents 0995381 + 78e785a commit 6018c7e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 16 deletions.
24 changes: 9 additions & 15 deletions lambdalib/__init__.py
Original file line number Diff line number Diff line change
@@ -1,31 +1,25 @@
from siliconcompiler import Chip
from siliconcompiler.package import path as sc_package
import siliconcompiler.package as sc_package
import glob
import os
import shutil
__version__ = "0.1.4"


def register_data_source(chip):
# check if local
root_path = os.path.dirname(os.path.dirname(__file__))
test_path = os.path.join(root_path, 'lambdalib', 'iolib', 'rtl', 'la_ioanalog.v')
if os.path.exists(test_path):
path = root_path
ref = None
else:
path = 'git+https://github.com/siliconcompiler/lambdalib.git'
ref = f'v{__version__}'

chip.register_package_source(name='lambdalib',
path=path,
ref=ref)
sc_package.register_python_data_source(
chip,
"lambdalib",
"lambdalib",
"git+https://github.com/siliconcompiler/lambdalib.git",
alternative_ref=f"v{__version__}",
python_module_path_append="..")


def __get_lambdalib_dir(la_lib):
path_assert = Chip('lambdalib')
register_data_source(path_assert)
lambdalib_path = sc_package(path_assert, 'lambdalib')
lambdalib_path = sc_package.path(path_assert, 'lambdalib')
return f'{lambdalib_path}/lambdalib/{la_lib}/rtl'


Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ urls = {Homepage = "https://github.com/siliconcompiler/lambdalib"}
requires-python = ">= 3.8"
license = {file = "LICENSE"}
dependencies = [
"siliconcompiler >= 0.17.0"
"siliconcompiler >= 0.20.2"
]
dynamic = ['version']

Expand Down

0 comments on commit 6018c7e

Please sign in to comment.