setup.py 3.5 KB

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