setup.py 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. #!/usr/bin/python3 -O
  2. # vim: fileencoding=utf-8
  3. import os
  4. import setuptools
  5. import setuptools.command.install
  6. # don't import: import * is unreliable and there is no need, since this is
  7. # compile time and we have source files
  8. def get_console_scripts():
  9. yield 'qrexec-policy', 'qubespolicy.cli'
  10. yield 'qrexec-policy-agent', 'qubespolicy.agent'
  11. yield 'qrexec-policy-graph', 'qubespolicy.graph'
  12. for filename in os.listdir('./qubes/tools'):
  13. basename, ext = os.path.splitext(os.path.basename(filename))
  14. if basename == '__init__' or ext != '.py':
  15. continue
  16. yield basename.replace('_', '-'), 'qubes.tools.{}'.format(basename)
  17. # create simple scripts that run much faster than "console entry points"
  18. class CustomInstall(setuptools.command.install.install):
  19. def run(self):
  20. bin = os.path.join(self.root, "usr/bin")
  21. try:
  22. os.makedirs(bin)
  23. except:
  24. pass
  25. for file, pkg in get_console_scripts():
  26. path = os.path.join(bin, file)
  27. with open(path, "w") as f:
  28. f.write(
  29. """#!/usr/bin/python3
  30. from {} import main
  31. import sys
  32. if __name__ == '__main__':
  33. sys.exit(main())
  34. """.format(pkg))
  35. os.chmod(path, 0o755)
  36. setuptools.command.install.install.run(self)
  37. if __name__ == '__main__':
  38. setuptools.setup(
  39. name='qubes',
  40. version=open('version').read().strip(),
  41. author='Invisible Things Lab',
  42. author_email='woju@invisiblethingslab.com',
  43. description='Qubes core package',
  44. license='GPL2+',
  45. url='https://www.qubes-os.org/',
  46. packages=setuptools.find_packages(exclude=('core*', 'tests')),
  47. package_data = {
  48. 'qubespolicy': ['glade/*.glade'],
  49. },
  50. cmdclass={
  51. 'install': CustomInstall,
  52. },
  53. entry_points={
  54. 'qubes.vm': [
  55. 'AppVM = qubes.vm.appvm:AppVM',
  56. 'TemplateVM = qubes.vm.templatevm:TemplateVM',
  57. 'StandaloneVM = qubes.vm.standalonevm:StandaloneVM',
  58. 'AdminVM = qubes.vm.adminvm:AdminVM',
  59. 'DispVM = qubes.vm.dispvm:DispVM',
  60. ],
  61. 'qubes.ext': [
  62. 'qubes.ext.admin = qubes.ext.admin:AdminExtension',
  63. 'qubes.ext.core_features = qubes.ext.core_features:CoreFeatures',
  64. 'qubes.ext.qubesmanager = qubes.ext.qubesmanager:QubesManager',
  65. 'qubes.ext.gui = qubes.ext.gui:GUI',
  66. 'qubes.ext.r3compatibility = qubes.ext.r3compatibility:R3Compatibility',
  67. 'qubes.ext.pci = qubes.ext.pci:PCIDeviceExtension',
  68. 'qubes.ext.block = qubes.ext.block:BlockDeviceExtension',
  69. 'qubes.ext.services = qubes.ext.services:ServicesExtension',
  70. ],
  71. 'qubes.devices': [
  72. 'pci = qubes.ext.pci:PCIDevice',
  73. 'block = qubes.ext.block:BlockDevice',
  74. 'testclass = qubes.tests.devices:TestDevice',
  75. ],
  76. 'qubes.storage': [
  77. 'file = qubes.storage.file:FilePool',
  78. 'file-reflink = qubes.storage.reflink:ReflinkPool',
  79. 'linux-kernel = qubes.storage.kernels:LinuxKernel',
  80. 'lvm_thin = qubes.storage.lvm:ThinPool',
  81. ],
  82. 'qubes.tests.storage': [
  83. 'test = qubes.tests.storage:TestPool',
  84. 'file = qubes.storage.file:FilePool',
  85. 'file-reflink = qubes.storage.reflink:ReflinkPool',
  86. 'linux-kernel = qubes.storage.kernels:LinuxKernel',
  87. 'lvm_thin = qubes.storage.lvm:ThinPool',
  88. ],
  89. })