setup.py 3.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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.backup_restore = '
  58. 'qubes.ext.backup_restore:BackupRestoreExtension',
  59. 'qubes.ext.core_features = qubes.ext.core_features:CoreFeatures',
  60. 'qubes.ext.gui = qubes.ext.gui:GUI',
  61. 'qubes.ext.audio = qubes.ext.audio:AUDIO',
  62. 'qubes.ext.r3compatibility = qubes.ext.r3compatibility:R3Compatibility',
  63. 'qubes.ext.pci = qubes.ext.pci:PCIDeviceExtension',
  64. 'qubes.ext.block = qubes.ext.block:BlockDeviceExtension',
  65. 'qubes.ext.services = qubes.ext.services:ServicesExtension',
  66. 'qubes.ext.supported_features = qubes.ext.supported_features:SupportedFeaturesExtension',
  67. 'qubes.ext.windows = qubes.ext.windows:WindowsFeatures',
  68. ],
  69. 'qubes.devices': [
  70. 'pci = qubes.ext.pci:PCIDevice',
  71. 'block = qubes.ext.block:BlockDevice',
  72. 'testclass = qubes.tests.devices:TestDevice',
  73. ],
  74. 'qubes.storage': [
  75. 'file = qubes.storage.file:FilePool',
  76. 'file-reflink = qubes.storage.reflink:ReflinkPool',
  77. 'linux-kernel = qubes.storage.kernels:LinuxKernel',
  78. 'lvm_thin = qubes.storage.lvm:ThinPool',
  79. ],
  80. 'qubes.tests.storage': [
  81. 'test = qubes.tests.storage:TestPool',
  82. 'file = qubes.storage.file:FilePool',
  83. 'file-reflink = qubes.storage.reflink:ReflinkPool',
  84. 'linux-kernel = qubes.storage.kernels:LinuxKernel',
  85. 'lvm_thin = qubes.storage.lvm:ThinPool',
  86. ],
  87. })