setup.py 3.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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. 'qubes.ext.windows = qubes.ext.windows:WindowsFeatures',
  71. ],
  72. 'qubes.devices': [
  73. 'pci = qubes.ext.pci:PCIDevice',
  74. 'block = qubes.ext.block:BlockDevice',
  75. 'testclass = qubes.tests.devices:TestDevice',
  76. ],
  77. 'qubes.storage': [
  78. 'file = qubes.storage.file:FilePool',
  79. 'file-reflink = qubes.storage.reflink:ReflinkPool',
  80. 'linux-kernel = qubes.storage.kernels:LinuxKernel',
  81. 'lvm_thin = qubes.storage.lvm:ThinPool',
  82. ],
  83. 'qubes.tests.storage': [
  84. 'test = qubes.tests.storage:TestPool',
  85. 'file = qubes.storage.file:FilePool',
  86. 'file-reflink = qubes.storage.reflink:ReflinkPool',
  87. 'linux-kernel = qubes.storage.kernels:LinuxKernel',
  88. 'lvm_thin = qubes.storage.lvm:ThinPool',
  89. ],
  90. })