packagewindows.py 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. import os, sys
  2. def DeleteDirectoryIfExists(top):
  3. if os.path.exists(top):
  4. DeleteDirectory(top)
  5. def DeleteDirectory(top):
  6. for root, dirs, files in os.walk(top, topdown=False):
  7. for name in files:
  8. os.remove(os.path.join(root, name))
  9. for name in dirs:
  10. os.rmdir(os.path.join(root, name))
  11. def GenerateInstallFiles(info):
  12. DeleteDirectoryIfExists(info.makeInstallPath)
  13. install.installAll(info.makeInstallPath + os.sep, 'bin', 'share', 'doc', info.openmsxExePath, 'mingw32', True, True)
  14. def WalkPath(sourcePath):
  15. if os.path.isfile(sourcePath):
  16. filenames = list()
  17. filenames.append(os.path.basename(sourcePath))
  18. yield os.path.dirname(sourcePath), list(), filenames
  19. else:
  20. for dirpath, dirnames, filenames in os.walk(sourcePath):
  21. yield dirpath, dirnames, filenames
  22. class PackageInfo:
  23. def __init__(self, platform, configuration, version, catapultPath):
  24. self.platform = platform.lower()
  25. if self.platform == 'win32':
  26. self.architecture = 'x86'
  27. self.platform = 'Win32'
  28. self.win64 = False
  29. elif self.platform == 'x64':
  30. self.architecture = 'x64'
  31. self.platform = 'x64'
  32. self.win64 = True
  33. else:
  34. raise ValueError, 'Wrong platform: ' + platform
  35. self.configuration = configuration.lower()
  36. if self.configuration == 'release':
  37. self.configuration = 'Release'
  38. self.catapultConfiguration = 'Unicode Release'
  39. elif self.configuration == 'Developer':
  40. self.configuration = 'Developer'
  41. self.catapultConfiguration = 'Unicode Debug'
  42. elif self.configuration == 'Debug':
  43. self.configuration = 'Debug'
  44. self.catapultConfiguration = 'Unicode Debug'
  45. else:
  46. raise ValueError, 'Wrong configuration: ' + architecture
  47. self.version = version
  48. self.catapultPath = catapultPath
  49. # Useful variables
  50. self.buildFlavor = self.platform + '-VC-' + self.configuration
  51. self.buildPath = os.path.join('derived', self.buildFlavor)
  52. self.installPath = os.path.join(self.buildPath, 'install')
  53. self.sourcePath = 'src'
  54. self.codecPath = 'Contrib\\codec\\Win32'
  55. self.packageWindowsPath = 'build\\package-windows'
  56. self.packagePath = os.path.join(self.buildPath, 'package-windows')
  57. self.makeInstallPath = os.path.join(self.packagePath, 'install')
  58. self.installerFileName = 'openmsx-debugger-' + version + '-VC-' + self.architecture
  59. if __name__ == '__main__':
  60. if len(sys.argv) == 5:
  61. info = PackageInfo(sys.argv[1], sys.argv[2], sys.argv[3], sys.argv[4])
  62. else:
  63. print >> sys.stderr, \
  64. 'Usage: python packagewindowsinfo.py architecture, configuration, version, catapultPath'
  65. sys.exit(2)