Skip to content

Commit

Permalink
Merge pull request #1 from AmirAref/refactor-autogen
Browse files Browse the repository at this point in the history
refactor autogen script and fix PCP name and links
  • Loading branch information
behdanisohrab authored Apr 13, 2024
2 parents 3d06931 + d2a0a3e commit 867b6c4
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 89 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# PPR: Parch Pacman repository
# PCP: Parch Community Packages

- [x86_64](x86_64)
71 changes: 37 additions & 34 deletions auto-gen.py
Original file line number Diff line number Diff line change
@@ -1,38 +1,41 @@
import logging
import os
from pathlib import Path

logging.basicConfig(level=logging.INFO, format="%(levelname)s: %(message)s")

archs = ("x86_64",)
archs_text = """[../](..)
"""
README_text = """# PPR: Parch Pacman repository
"""
base_url = "https://raw.githubusercontent.com/parchlinux/ppr/main/{arch}/{package}"

for arch in archs:
logging.info("Generating for arch: %s", arch)
README_text += f"- [{arch}]({arch})\n"

packages = os.listdir(arch)
packages.sort()

for package in packages:
if not ".zst" in package:
continue

logging.info("Generating for package: %s", package)
archs_text += (
f"- [{package.split('.')[0]}]"
+ "("
+ base_url.format(arch=arch, package=package)
+ ")\n"
)

with open(f"{arch}/README.md", "w") as f:
f.write(archs_text)

with open("README.md", "w") as f:
f.write(README_text)
archs = (Path("x86_64"),)

base_url = "https://raw.githubusercontent.com/parchlinux/pcp/main/{arch}/{package}"


def main():
# root README content
README_text = "# PCP: Parch Community Packages\n\n"

for arch in archs:
# add current arch to root README.md
logging.info("Generating for arch: %s", arch)
README_text += f"- [{arch}]({arch})\n"

# this arch README.md content body
archs_text = "[../](..)\n\n"
# get packages list
packages = sorted(tuple(arch.glob("*.zst")))
# add packages link
for package in packages:
logging.info("Generating for package: %s", package)
_package_url = base_url.format(arch=arch, package=package.name)
archs_text += "- [{name}]({url})\n".format(
name=package.name.split(".")[0],
url=_package_url,
)
# create README file for this arch
with open(arch / "README.md", "w") as f:
f.write(archs_text)
# create root README.md file
with open("README.md", "w") as f:
f.write(README_text)


if __name__ == "__main__":
main()
54 changes: 0 additions & 54 deletions x86_64/README.md
Original file line number Diff line number Diff line change
@@ -1,55 +1 @@
[../](..)

- [amberol-0](https://raw.githubusercontent.com/parchlinux/ppr/main/x86_64/amberol-0.10.3-1-x86_64.pkg.tar.zst)
- [ambiant-mate-gtk-themes-22](https://raw.githubusercontent.com/parchlinux/ppr/main/x86_64/ambiant-mate-gtk-themes-22.04.2-1-any.pkg.tar.zst)
- [appimagepool-appimage-5](https://raw.githubusercontent.com/parchlinux/ppr/main/x86_64/appimagepool-appimage-5.1.0-1-x86_64.pkg.tar.zst)
- [bearings-bin-1-0-x86_64](https://raw.githubusercontent.com/parchlinux/ppr/main/x86_64/bearings-bin-1-0-x86_64.pkg.tar.zst)
- [carburetor-4](https://raw.githubusercontent.com/parchlinux/ppr/main/x86_64/carburetor-4.5.1-1-any.pkg.tar.zst)
- [catppuccin-gtk-theme-macchiato-0](https://raw.githubusercontent.com/parchlinux/ppr/main/x86_64/catppuccin-gtk-theme-macchiato-0.6.1-2-any.pkg.tar.zst)
- [catppuccin-gtk-theme-mocha-0](https://raw.githubusercontent.com/parchlinux/ppr/main/x86_64/catppuccin-gtk-theme-mocha-0.6.0-1-any.pkg.tar.zst)
- [catppuccin-mocha-dark-cursors-1](https://raw.githubusercontent.com/parchlinux/ppr/main/x86_64/catppuccin-mocha-dark-cursors-1.00-1-any.pkg.tar.zst)
- [community-backgrounds-1-1-any](https://raw.githubusercontent.com/parchlinux/ppr/main/x86_64/community-backgrounds-1-1-any.pkg.tar.zst)
- [dmscripts-git-1](https://raw.githubusercontent.com/parchlinux/ppr/main/x86_64/dmscripts-git-1.0.r485.343ed73-1-any.pkg.tar.zst)
- [dnsch-1](https://raw.githubusercontent.com/parchlinux/ppr/main/x86_64/dnsch-1.1-1-any.pkg.tar.zst)
- [fira-code-font-1-0-x86_64](https://raw.githubusercontent.com/parchlinux/ppr/main/x86_64/fira-code-font-1-0-x86_64.pkg.tar.zst)
- [fira-code-mono-1-0-x86_64](https://raw.githubusercontent.com/parchlinux/ppr/main/x86_64/fira-code-mono-1-0-x86_64.pkg.tar.zst)
- [folio-24](https://raw.githubusercontent.com/parchlinux/ppr/main/x86_64/folio-24.10-1-x86_64.pkg.tar.zst)
- [galaxybudsclient-bin-4](https://raw.githubusercontent.com/parchlinux/ppr/main/x86_64/galaxybudsclient-bin-4.5.3-6-x86_64.pkg.tar.zst)
- [loutos-1](https://raw.githubusercontent.com/parchlinux/ppr/main/x86_64/loutos-1.1.0-1-x86_64.pkg.tar.zst)
- [mpvpaper-1](https://raw.githubusercontent.com/parchlinux/ppr/main/x86_64/mpvpaper-1.4-1-x86_64.pkg.tar.zst)
- [nm-tray-0](https://raw.githubusercontent.com/parchlinux/ppr/main/x86_64/nm-tray-0.5.0-1-x86_64.pkg.tar.zst)
- [nordic-bluish-accent-standard-buttons-theme-2](https://raw.githubusercontent.com/parchlinux/ppr/main/x86_64/nordic-bluish-accent-standard-buttons-theme-2.0.0-1-x86_64.pkg.tar.zst)
- [nordzy-cursors-0](https://raw.githubusercontent.com/parchlinux/ppr/main/x86_64/nordzy-cursors-0.6.0-1-any.pkg.tar.zst)
- [nvpak-1-0-any](https://raw.githubusercontent.com/parchlinux/ppr/main/x86_64/nvpak-1-0-any.pkg.tar.zst)
- [openbox-arc-git-20230530](https://raw.githubusercontent.com/parchlinux/ppr/main/x86_64/openbox-arc-git-20230530.r21.5ebdb7f-1-any.pkg.tar.zst)
- [orchis-theme-2023_10_20-1-any](https://raw.githubusercontent.com/parchlinux/ppr/main/x86_64/orchis-theme-2023_10_20-1-any.pkg.tar.zst)
- [parch-budgie-config-1-0-x86_64](https://raw.githubusercontent.com/parchlinux/ppr/main/x86_64/parch-budgie-config-1-0-x86_64.pkg.tar.zst)
- [parch-community-backgrounds-2-0-any](https://raw.githubusercontent.com/parchlinux/ppr/main/x86_64/parch-community-backgrounds-2-0-any.pkg.tar.zst)
- [parch-cutefish-fix-1-0-any](https://raw.githubusercontent.com/parchlinux/ppr/main/x86_64/parch-cutefish-fix-1-0-any.pkg.tar.zst)
- [parch-dwm-config-2-1-x86_64](https://raw.githubusercontent.com/parchlinux/ppr/main/x86_64/parch-dwm-config-2-1-x86_64.pkg.tar.zst)
- [parch-dwm-dots-6](https://raw.githubusercontent.com/parchlinux/ppr/main/x86_64/parch-dwm-dots-6.5-0-x86_64.pkg.tar.zst)
- [parch-hypr-kuru-2-3-any](https://raw.githubusercontent.com/parchlinux/ppr/main/x86_64/parch-hypr-kuru-2-3-any.pkg.tar.zst)
- [parch-iran-backgrounds-1](https://raw.githubusercontent.com/parchlinux/ppr/main/x86_64/parch-iran-backgrounds-1.0.5-1-any.pkg.tar.zst)
- [parch-iran-backgrounds-kde-1](https://raw.githubusercontent.com/parchlinux/ppr/main/x86_64/parch-iran-backgrounds-kde-1.0.5-1-any.pkg.tar.zst)
- [parch-license-fix-1-1-any](https://raw.githubusercontent.com/parchlinux/ppr/main/x86_64/parch-license-fix-1-1-any.pkg.tar.zst)
- [parch-lxqt-config-1-1-any](https://raw.githubusercontent.com/parchlinux/ppr/main/x86_64/parch-lxqt-config-1-1-any.pkg.tar.zst)
- [parch-mpv-1-1-any](https://raw.githubusercontent.com/parchlinux/ppr/main/x86_64/parch-mpv-1-1-any.pkg.tar.zst)
- [parch-pantheon-1-0-any](https://raw.githubusercontent.com/parchlinux/ppr/main/x86_64/parch-pantheon-1-0-any.pkg.tar.zst)
- [parch-tde-1-0-any](https://raw.githubusercontent.com/parchlinux/ppr/main/x86_64/parch-tde-1-0-any.pkg.tar.zst)
- [parch-wm-calamares-1-1-x86_64](https://raw.githubusercontent.com/parchlinux/ppr/main/x86_64/parch-wm-calamares-1-1-x86_64.pkg.tar.zst)
- [parrot-bin-1](https://raw.githubusercontent.com/parchlinux/ppr/main/x86_64/parrot-bin-1.0.6-1-x86_64.pkg.tar.zst)
- [pfetch-r434](https://raw.githubusercontent.com/parchlinux/ppr/main/x86_64/pfetch-r434.ce1d56e-1-any.pkg.tar.zst)
- [pop-launcher-git-1](https://raw.githubusercontent.com/parchlinux/ppr/main/x86_64/pop-launcher-git-1.2.1.r55.gc233078-1-x86_64.pkg.tar.zst)
- [pop-shell-plugin-system76-power-git-1](https://raw.githubusercontent.com/parchlinux/ppr/main/x86_64/pop-shell-plugin-system76-power-git-1.2.1.r55.gc233078-1-x86_64.pkg.tar.zst)
- [prime-switcher-1](https://raw.githubusercontent.com/parchlinux/ppr/main/x86_64/prime-switcher-1.0.2-1-any.pkg.tar.zst)
- [quickemu-4](https://raw.githubusercontent.com/parchlinux/ppr/main/x86_64/quickemu-4.8-1-any.pkg.tar.zst)
- [quickgui-bin-1](https://raw.githubusercontent.com/parchlinux/ppr/main/x86_64/quickgui-bin-1.2.8-1-x86_64.pkg.tar.zst)
- [sticky-1](https://raw.githubusercontent.com/parchlinux/ppr/main/x86_64/sticky-1.16-1-any.pkg.tar.zst)
- [system76-power-1](https://raw.githubusercontent.com/parchlinux/ppr/main/x86_64/system76-power-1.1.25-1-any.pkg.tar.zst)
- [tasky-0-5-any](https://raw.githubusercontent.com/parchlinux/ppr/main/x86_64/tasky-0-5-any.pkg.tar.zst)
- [timeshift-23](https://raw.githubusercontent.com/parchlinux/ppr/main/x86_64/timeshift-23.06.2-1-x86_64.pkg.tar.zst)
- [tractor-4](https://raw.githubusercontent.com/parchlinux/ppr/main/x86_64/tractor-4.5.1-1-any.pkg.tar.zst)
- [webapp-manager-1](https://raw.githubusercontent.com/parchlinux/ppr/main/x86_64/webapp-manager-1.3.0-1-any.pkg.tar.zst)
- [windscribe-v2-bin-2](https://raw.githubusercontent.com/parchlinux/ppr/main/x86_64/windscribe-v2-bin-2.6.14-1-x86_64.pkg.tar.zst)
- [yay-bin-12](https://raw.githubusercontent.com/parchlinux/ppr/main/x86_64/yay-bin-12.3.5-1-x86_64.pkg.tar.zst)
- [zramd-0](https://raw.githubusercontent.com/parchlinux/ppr/main/x86_64/zramd-0.9.2-1-any.pkg.tar.zst)

0 comments on commit 867b6c4

Please sign in to comment.