__init__.py 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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. print(" {0}: {1}".format(package.name, package.url))
  32. except Exception:
  33. from traceback import format_exc
  34. msg = "Error encountered:\n" + format_exc().strip()
  35. print(term().red(msg))
  36. sys.exit(1)
  37. if __name__ == '__main__':
  38. main(sys.argv[1:])