tools: Allow overriding version string in build_client.

This commit is contained in:
Sam Edwards 2013-12-07 04:15:10 -07:00
parent 3d03bf1269
commit 12dd12e06a

View file

@ -57,8 +57,9 @@ def determineVersion(cwd):
class ClientBuilder(object):
MAINMODULE = 'toontown.toonbase.MiraiStart'
def __init__(self, directory):
def __init__(self, directory, version=None):
self.directory = directory
self.version = version or determineVersion(self.directory)
self.dcfiles = [os.path.join(directory, 'config/otp.dc'),
os.path.join(directory, 'config/toon.dc')]
@ -114,7 +115,7 @@ class ClientBuilder(object):
configData = []
with open(os.path.join(self.directory, 'config/public_client.prc')) as f:
fd = f.read()
fd = fd.replace('SERVER_VERSION_HERE', determineVersion(self.directory))
fd = fd.replace('SERVER_VERSION_HERE', self.version)
configData.append(fd)
# Now add pytz timezones:
@ -210,6 +211,7 @@ if __name__ == '__main__':
'mirai -- a Mirai package\n'
'zip -- a zip file of pyos\n'
'list -- a plaintext list of included modules')
parser.add_argument('--version', help='Override the version string packed into the built blob.')
parser.add_argument('output', help='The filename of the built file to output.')
args = parser.parse_args()
@ -218,7 +220,7 @@ if __name__ == '__main__':
p3d_path = os.path.join(args.mirai_path, 'panda3d-1.8.1')
sys.path.insert(0, p3d_path)
cb = ClientBuilder(root)
cb = ClientBuilder(root, args.version)
if args.mirai_path:
cb.mf.import_hook('direct').__path__ = [os.path.join(p3d_path, 'direct/src')]