No Description

organiccode 1.4KB

12345678910111213141516171819202122232425262728293031323334353637
  1. #!/usr/bin/python
  2. # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
  3. ### BEGIN LICENSE
  4. # This file is in the public domain
  5. ### END LICENSE
  6. ### DO NOT EDIT THIS FILE ###
  7. import sys
  8. import os
  9. import locale
  10. locale.textdomain('organiccode')
  11. # Add project root directory (enable symlink and trunk execution)
  12. PROJECT_ROOT_DIRECTORY = os.path.abspath(
  13. os.path.dirname(os.path.dirname(os.path.realpath(sys.argv[0]))))
  14. python_path = []
  15. if os.path.abspath(__file__).startswith('/opt'):
  16. locale.bindtextdomain('organiccode', '/opt/extras.ubuntu.com/organiccode/share/locale')
  17. syspath = sys.path[:] # copy to avoid infinite loop in pending objects
  18. for path in syspath:
  19. opt_path = path.replace('/usr', '/opt/extras.ubuntu.com/organiccode')
  20. python_path.insert(0, opt_path)
  21. sys.path.insert(0, opt_path)
  22. os.putenv("XDG_DATA_DIRS", "%s:%s" % ("/opt/extras.ubuntu.com/organiccode/share/", os.getenv("XDG_DATA_DIRS", "/usr/local/share/:/usr/share/")))
  23. if (os.path.exists(os.path.join(PROJECT_ROOT_DIRECTORY, 'organiccode'))
  24. and PROJECT_ROOT_DIRECTORY not in sys.path):
  25. python_path.insert(0, PROJECT_ROOT_DIRECTORY)
  26. sys.path.insert(0, PROJECT_ROOT_DIRECTORY)
  27. if python_path:
  28. os.putenv('PYTHONPATH', "%s:%s" % (os.getenv('PYTHONPATH', ''), ':'.join(python_path))) # for subprocesses
  29. import organiccode
  30. organiccode.main()