File: packagewindows.py

package info (click to toggle)
openmsx-debugger 0.1~git20160326-2
  • links: PTS
  • area: main
  • in suites: stretch
  • size: 2,036 kB
  • ctags: 1,708
  • sloc: cpp: 11,862; python: 518; sh: 45; makefile: 13
file content (78 lines) | stat: -rw-r--r-- 2,675 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
import os, sys

def DeleteDirectoryIfExists(top):
	if os.path.exists(top):
		DeleteDirectory(top)
		
def DeleteDirectory(top):
	for root, dirs, files in os.walk(top, topdown=False):
		for name in files:
			os.remove(os.path.join(root, name))
		for name in dirs:
			os.rmdir(os.path.join(root, name))

def GenerateInstallFiles(info):
	DeleteDirectoryIfExists(info.makeInstallPath)
	install.installAll(info.makeInstallPath + os.sep, 'bin', 'share', 'doc', info.openmsxExePath, 'mingw32', True, True)

def WalkPath(sourcePath):
    if os.path.isfile(sourcePath):
        filenames = list()
        filenames.append(os.path.basename(sourcePath))
        yield os.path.dirname(sourcePath), list(), filenames
    else:
        for dirpath, dirnames, filenames in os.walk(sourcePath):
            yield dirpath, dirnames, filenames

class PackageInfo:

	def __init__(self, platform, configuration, version, catapultPath):
		
		self.platform = platform.lower()
		if self.platform == 'win32':
			self.architecture = 'x86'
			self.platform = 'Win32'
			self.win64 = False
		elif self.platform == 'x64':
			self.architecture = 'x64'
			self.platform = 'x64'
			self.win64 = True
		else:
			raise ValueError, 'Wrong platform: ' + platform
			
		self.configuration = configuration.lower()
		if self.configuration == 'release':
			self.configuration = 'Release'
			self.catapultConfiguration = 'Unicode Release'
		elif self.configuration == 'Developer':
			self.configuration = 'Developer'
			self.catapultConfiguration = 'Unicode Debug'
		elif self.configuration == 'Debug':
			self.configuration = 'Debug'
			self.catapultConfiguration = 'Unicode Debug'
		else:
			raise ValueError, 'Wrong configuration: ' + architecture

		self.version = version
		self.catapultPath = catapultPath
		
		# Useful variables
		self.buildFlavor = self.platform + '-VC-' + self.configuration
		self.buildPath = os.path.join('derived', self.buildFlavor)
		self.installPath = os.path.join(self.buildPath, 'install')
		self.sourcePath = 'src'
		self.codecPath = 'Contrib\\codec\\Win32'
		self.packageWindowsPath = 'build\\package-windows'
		
		self.packagePath = os.path.join(self.buildPath, 'package-windows')
		self.makeInstallPath = os.path.join(self.packagePath, 'install')
		
		self.installerFileName = 'openmsx-debugger-' + version + '-VC-' + self.architecture
		
if __name__ == '__main__':
	if len(sys.argv) == 5:
		info = PackageInfo(sys.argv[1], sys.argv[2], sys.argv[3], sys.argv[4])
	else:
		print >> sys.stderr, \
			'Usage: python packagewindowsinfo.py architecture, configuration, version, catapultPath'
		sys.exit(2)