Compare commits
6 Commits
add_commen
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
00b9e1d907 | ||
|
|
3a72154055 | ||
|
|
b8cd278cf1 | ||
|
|
7801876c85 | ||
|
|
654cd49303
|
||
|
|
0676e20727
|
37
.gitea/workflows/publish.yaml
Normal file
37
.gitea/workflows/publish.yaml
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
name: Publish Package
|
||||||
|
on: [push]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
name: Build Package
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- uses: actions/setup-python@v5
|
||||||
|
with:
|
||||||
|
python-version: "3.x"
|
||||||
|
- run: python3 -m pip install build --user
|
||||||
|
- run: python -m build
|
||||||
|
- uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: python-package-distributions
|
||||||
|
path: dist/
|
||||||
|
|
||||||
|
deploy:
|
||||||
|
name: Deploy Package
|
||||||
|
needs:
|
||||||
|
- build
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- uses: actions/setup-python@v5
|
||||||
|
with:
|
||||||
|
python-version: "3.x"
|
||||||
|
- run: python3 -m pip install twine --user
|
||||||
|
- uses: actions/download-artifact@v3
|
||||||
|
name: python-package-distributions
|
||||||
|
path: dist/ # Does this even do anything?
|
||||||
|
- run: ls -laR python-package-distributions
|
||||||
|
- run: TWINE_PASSWORD=${{ secrets.PYPI_PAT }} TWINE_USERNAME=bslathi19 python -m twine upload --repository-url ${{ vars.CI_API_URL }} python-package-distributions/*
|
||||||
5
build/lib/rtl_manifest/__init__.py
Normal file
5
build/lib/rtl_manifest/__init__.py
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
from .rtl_manifest import rtl_manifest_main
|
||||||
|
from .rtl_manifest import read_sources
|
||||||
|
|
||||||
|
def main():
|
||||||
|
rtl_manifest_main()
|
||||||
61
build/lib/rtl_manifest/rtl_manifest.py
Normal file
61
build/lib/rtl_manifest/rtl_manifest.py
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
|
||||||
|
import argparse
|
||||||
|
from typing import List, Tuple
|
||||||
|
import pathlib
|
||||||
|
|
||||||
|
import os
|
||||||
|
|
||||||
|
|
||||||
|
def rtl_manifest_main():
|
||||||
|
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]:
|
||||||
|
sources, incdirs = parse(source_file)
|
||||||
|
|
||||||
|
return sources
|
||||||
|
|
||||||
|
def read_incdirs(source_file: str) -> List[str]:
|
||||||
|
sources, incdirs = parse(source_file)
|
||||||
|
|
||||||
|
return incdirs
|
||||||
|
|
||||||
|
def parse(source_file: str) -> Tuple[List[str], List[str]]:
|
||||||
|
files = []
|
||||||
|
incdirs = []
|
||||||
|
|
||||||
|
def _recursive_parse(source_file: str):
|
||||||
|
base_dir = pathlib.Path(source_file).parent
|
||||||
|
with open(source_file, "r") as file:
|
||||||
|
for line in file:
|
||||||
|
path = os.path.expandvars(line.strip())
|
||||||
|
if path.startswith("#"):
|
||||||
|
continue
|
||||||
|
if path == "":
|
||||||
|
continue
|
||||||
|
if path.startswith("`include "):
|
||||||
|
abs_path = pathlib.Path(base_dir / path.split()[1]).absolute()
|
||||||
|
incdirs.append(str(abs_path))
|
||||||
|
continue
|
||||||
|
if (path.endswith("sources.list")):
|
||||||
|
new_path = pathlib.Path(base_dir) / path
|
||||||
|
_recursive_parse(new_path)
|
||||||
|
else:
|
||||||
|
abs_path = pathlib.Path(base_dir / path).absolute()
|
||||||
|
files.append(str(abs_path))
|
||||||
|
|
||||||
|
_recursive_parse(source_file)
|
||||||
|
|
||||||
|
return files, incdirs
|
||||||
@@ -1,3 +1,5 @@
|
|||||||
python -m venv .venv
|
python3 -m venv .venv
|
||||||
source .venv/bin/activate
|
source .venv/bin/activate
|
||||||
pip install -r requirements.txt
|
pip install -r requirements.txt
|
||||||
|
|
||||||
|
export TOP_DIR=$(git rev-parse --show-toplevel)
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ name = "rtl-manifest" # REQUIRED, is the only field that cannot be marked as dy
|
|||||||
# https://packaging.python.org/guides/single-sourcing-package-version/
|
# https://packaging.python.org/guides/single-sourcing-package-version/
|
||||||
|
|
||||||
# dynamic = ["version"]
|
# dynamic = ["version"]
|
||||||
version = "0.1.1" # REQUIRED, although can be dynamic
|
version = "0.4.0" # REQUIRED, although can be dynamic
|
||||||
|
|
||||||
# This is a one-line description or tagline of what your project does. This
|
# This is a one-line description or tagline of what your project does. This
|
||||||
# corresponds to the "Summary" metadata field:
|
# corresponds to the "Summary" metadata field:
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
from typing import List
|
from typing import List, Tuple
|
||||||
import pathlib
|
import pathlib
|
||||||
|
|
||||||
|
import os
|
||||||
|
|
||||||
|
|
||||||
def rtl_manifest_main():
|
def rtl_manifest_main():
|
||||||
parser = argparse.ArgumentParser(
|
parser = argparse.ArgumentParser(
|
||||||
@@ -21,21 +23,39 @@ def rtl_manifest_main():
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
def read_sources(source_file: str) -> List[str]:
|
def read_sources(source_file: str) -> List[str]:
|
||||||
|
sources, incdirs = parse(source_file)
|
||||||
|
|
||||||
|
return sources
|
||||||
|
|
||||||
|
def read_incdirs(source_file: str) -> List[str]:
|
||||||
|
sources, incdirs = parse(source_file)
|
||||||
|
|
||||||
|
return incdirs
|
||||||
|
|
||||||
|
def parse(source_file: str) -> Tuple[List[str], List[str]]:
|
||||||
files = []
|
files = []
|
||||||
base_dir = pathlib.Path(source_file).parent
|
incdirs = []
|
||||||
|
|
||||||
|
def _recursive_parse(source_file: str):
|
||||||
|
base_dir = pathlib.Path(source_file).parent
|
||||||
|
with open(source_file, "r") as file:
|
||||||
|
for line in file:
|
||||||
|
path = os.path.expandvars(line.strip())
|
||||||
|
if path.startswith("#"):
|
||||||
|
continue
|
||||||
|
if path == "":
|
||||||
|
continue
|
||||||
|
if path.startswith("`include "):
|
||||||
|
abs_path = pathlib.Path(base_dir / path.split()[1]).absolute()
|
||||||
|
incdirs.append(str(abs_path))
|
||||||
|
continue
|
||||||
|
if (path.endswith("sources.list")):
|
||||||
|
new_path = pathlib.Path(base_dir) / path
|
||||||
|
_recursive_parse(new_path)
|
||||||
|
else:
|
||||||
|
abs_path = pathlib.Path(base_dir / path).absolute()
|
||||||
|
files.append(str(abs_path))
|
||||||
|
|
||||||
with open(source_file, "r") as file:
|
_recursive_parse(source_file)
|
||||||
for line in file:
|
|
||||||
path = line.strip()
|
|
||||||
if path.startswith("#"):
|
|
||||||
continue
|
|
||||||
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
|
return files, incdirs
|
||||||
|
|||||||
0
test/other_file.txt
Normal file
0
test/other_file.txt
Normal file
@@ -1,3 +1,8 @@
|
|||||||
src/sub/submodule/sources.list
|
src/sub/submodule/sources.list
|
||||||
src/example.sv
|
src/example.sv
|
||||||
# This is a comment!
|
# This is a comment!
|
||||||
|
|
||||||
|
# ^ above was a blank line
|
||||||
|
`include .
|
||||||
|
|
||||||
|
$TOP_DIR/src/other_file.txt
|
||||||
|
|||||||
Reference in New Issue
Block a user