Created
August 2, 2022 04:22
-
-
Save daviirodrig/f227d090af1897e395d0ee3e84c5f2ad to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
This script remove the version from package version | |
""" | |
import re | |
from typing import List | |
regex = re.compile(r"(.*)(-)(.*)(-)(\d)") | |
def read_file() -> List[str]: | |
""" | |
pkgs.txt must be a file with each package in a new line | |
example: | |
firefox-103.0.1-1 | |
electron-19.0.10-1 | |
""" | |
with open("pkgs.txt", "r") as f: | |
pkgs = f.readlines() | |
return pkgs | |
def main(): | |
command = "yay -S" | |
pkg_list = read_file() | |
for pkg in pkg_list: | |
res = regex.search(pkg) | |
pkg_name = res.group(1) | |
command += f" {pkg_name}" | |
print(command) | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment