From 78e785ab1882ab00cf6677ec44565292468eda5b Mon Sep 17 00:00:00 2001 From: Peter Gadfort Date: Tue, 20 Feb 2024 09:49:28 -0500 Subject: [PATCH] use sc_package to register python information --- lambdalib/__init__.py | 24 +++++++++--------------- pyproject.toml | 2 +- 2 files changed, 10 insertions(+), 16 deletions(-) diff --git a/lambdalib/__init__.py b/lambdalib/__init__.py index fadc4bb..b87766d 100644 --- a/lambdalib/__init__.py +++ b/lambdalib/__init__.py @@ -1,5 +1,5 @@ from siliconcompiler import Chip -from siliconcompiler.package import path as sc_package +import siliconcompiler.package as sc_package import glob import os import shutil @@ -7,25 +7,19 @@ 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' diff --git a/pyproject.toml b/pyproject.toml index f313a2c..f88607d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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']