Skip to content

Commit

Permalink
fix: fixed merged python artifact
Browse files Browse the repository at this point in the history
  • Loading branch information
RonTamG committed Feb 6, 2024
1 parent dc271d2 commit 941f956
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 629 deletions.
6 changes: 4 additions & 2 deletions .github/clean_imports.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,12 @@ def remove_module_imports(code, modules_to_remove):

code = sys.stdin.read()
modules_to_remove = [
"src.index",
"src.package",
"src.progressbar",
"src.version",
"src.sources_list",
"src.file_manager",
"src.update",
"src.packages",
"src.install",
]

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/python-app.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ jobs:
- name: Install dependencies
run: pip install black isort
- name: Merge source files
run: cat src/sources_list.py src/file_manager.py src/update.py src/packages.py src/install.py main.py | python .github/clean_imports.py | isort --float-to-top - | black - > pyapt.py
run: cat src/progress_bar.py src/sources_list.py src/version.py src/package.py src/index.py src/file_manager.py src/install.py main.py | python .github/clean_imports.py | isort --float-to-top - | black - > pyapt.py
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
Expand Down
17 changes: 16 additions & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,26 @@
from src.install import create_install_script
from src.progress_bar import progressbar
from src.sources_list import SourcesList
from src.update import get_apt_sources

DEFAULT_ARCHITECTURE = "amd64"


def get_apt_sources(url):
"""
return the apt sources of a given index package url
"""
pattern = re.compile(
r"(?P<url>\w+://.+?/.+)/dists/(?P<dist>.+?)/(?P<component>.+?)/binary-(?P<arch>.+?)/Packages"
)
result = re.match(pattern, url)
if result is None:
raise ValueError("url has invalid format")

uri, dist, component, architecture = result.groups()

return f"{uri} {dist}/{component} {architecture}"


def tar_dir(path, name):
def set_permissions(tarinfo):
tarinfo.mode = 0o755
Expand Down
128 changes: 0 additions & 128 deletions src/packages.py

This file was deleted.

202 changes: 0 additions & 202 deletions src/update.py

This file was deleted.

Loading

0 comments on commit 941f956

Please sign in to comment.