Add actions
This commit is contained in:
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
|
||||
Reference in New Issue
Block a user