Merge branch '1-actually-do-something' into 'master'

Resolve "Actually do something"

Closes #1

See merge request bslathi19/rtl-manifest!1
This commit is contained in:
Byron Lathi
2024-06-07 01:54:15 +00:00
9 changed files with 70 additions and 4 deletions

View File

@@ -1,7 +1,34 @@
image: python:latest
run:
stages:
- build
- test
- deploy
build:
stage: build
rules:
- when: always
artifacts:
paths:
- ./dist
script:
- source init_env.sh
- python -m build
test:
stage: test
rules:
- when: always
script:
- echo "Haha no tests yet"
deploy:
stage: deploy
rules:
# only run on MRs to main
- if: $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "main"
# run on commits to main
- if: $CI_COMMIT_BRANCH == "main"
script:
- TWINE_PASSWORD=${CI_JOB_TOKEN} TWINE_USERNAME=gitlab-ci-token python -m twine upload --repository-url ${CI_API_V4_URL}/projects/${PACKAGE_PROJECT_ID}/packages/pypi dist/*

View File

@@ -33,7 +33,7 @@ name = "rtl-manifest" # REQUIRED, is the only field that cannot be marked as dy
#
# For a discussion on single-sourcing the version, see
# https://packaging.python.org/guides/single-sourcing-package-version/
version = "0.0.1" # REQUIRED, although can be dynamic
version = "0.0.2" # REQUIRED, although can be dynamic
# This is a one-line description or tagline of what your project does. This
# corresponds to the "Summary" metadata field:

View File

@@ -1,4 +1,39 @@
import argparse
from typing import List
import pathlib
def rtl_manifest_main():
print("Hello, world!")
parser = argparse.ArgumentParser(
prog='rtl-manifest',
description='Read in sources.list files and return a string of all source files',
epilog='Made by Byron Lathi')
parser.add_argument("source")
args = parser.parse_args()
files = read_sources(args.source)
for file in files:
print(file, end = " ")
pass
def read_sources(source_file: str) -> List[str]:
files = []
base_dir = pathlib.Path(source_file).parent
with open(source_file, "r") as file:
for line in file:
path = line.strip()
if (path.endswith("sources.list")):
new_path = pathlib.Path(base_dir) / path
for recursive_path in read_sources(new_path):
files.append(recursive_path)
else:
abs_path = pathlib.Path(base_dir / path).absolute()
files.append(str(abs_path))
return files

2
test/sources.list Normal file
View File

@@ -0,0 +1,2 @@
src/sub/submodule/sources.list
src/example.sv

0
test/src/example.sv Normal file
View File

View File

@@ -0,0 +1,2 @@
other_submodule.sv
submodule_regs.rdl

View File