setup.py 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. # vim: fileencoding=utf-8
  2. import os
  3. import setuptools
  4. import setuptools.command.install
  5. import re
  6. CONSOLE_SCRIPTS = [
  7. ('qubes-firewall', 'qubesagent.firewall'),
  8. ('qubes-vmexec', 'qubesagent.vmexec'),
  9. ]
  10. # create simple scripts that run much faster than "console entry points"
  11. class CustomInstall(setuptools.command.install.install):
  12. def run(self):
  13. bin = os.path.join(self.root, "usr/bin")
  14. try:
  15. os.makedirs(bin)
  16. except:
  17. pass
  18. for file, pkg in CONSOLE_SCRIPTS:
  19. path = os.path.join(bin, file)
  20. with open(path, "w") as f:
  21. f.write(
  22. """#!/usr/bin/python3
  23. from {} import main
  24. import sys
  25. if __name__ == '__main__':
  26. sys.exit(main())
  27. """.format(pkg))
  28. os.chmod(path, 0o755)
  29. setuptools.command.install.install.run(self)
  30. if __name__ == '__main__':
  31. setuptools.setup(
  32. name='qubesagent',
  33. version=open('version').read().strip(),
  34. author='Invisible Things Lab',
  35. author_email='marmarek@invisiblethingslab.com',
  36. description='Qubes core-agent-linux package',
  37. license='GPL2+',
  38. url='https://www.qubes-os.org/',
  39. packages=('qubesagent',),
  40. cmdclass={
  41. 'install': CustomInstall,
  42. },
  43. )