setup.py 3.5 KB

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