1
0

__init__.py 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. import sys
  2. from .config import Config
  3. from .util import term
  4. from .repo import Repo
  5. def main(args):
  6. try:
  7. config = Config(args[0] if len(args) else '/etc/pacman-repo.d')
  8. print(config.path)
  9. print('---')
  10. print()
  11. print(config)
  12. print()
  13. for repo in config.repos:
  14. print(repo.path)
  15. print('---')
  16. print()
  17. print(repo)
  18. print()
  19. for server in config.servers:
  20. print(server.path)
  21. print('---')
  22. print()
  23. print(server)
  24. print()
  25. repos = []
  26. for repo in config.repos:
  27. repo = Repo(repo)
  28. repos.append(repo)
  29. print("Repo: {}".format(repo.name))
  30. for package in repo.packages:
  31. package.update()
  32. print(" {0}: {1}".format(package.name, package.url))
  33. package.makepkg()
  34. except Exception:
  35. from traceback import format_exc
  36. msg = "Error encountered:\n" + format_exc().strip()
  37. print(term().red(msg))
  38. sys.exit(1)
  39. if __name__ == '__main__':
  40. main(sys.argv[1:])