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