Skip to content

Commit

Permalink
DEVTOOLS: Rename dict to arg_dict and add shebang line for python3 in…
Browse files Browse the repository at this point in the history
… package.py
  • Loading branch information
ankushdutt committed Aug 29, 2023
1 parent b387111 commit df393af
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions devtools/packaging/package.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
#!/usr/bin/env python3

import argparse
import json
import subprocess
import sys


def prepare(ex, game, dict):
def prepare(ex, game, arg_dict):
if ex["prepare"]["type"] == "python-script":
cmd = sys.executable + " scripts/" + ex["prepare"]["location"]
for key in ex["prepare"]["options"].keys():
Expand All @@ -17,15 +19,15 @@ def prepare(ex, game, dict):
# check in game's metadata
cmd += game[value[2:]]
elif len(value) >= 1 and value[0] == '$':
cmd += dict[value[1:]]
cmd += arg_dict[value[1:]]
else:
cmd += value

subprocess.run(cmd, shell=True)
print(ex["prepare"]["successMessage"])


def bundle(ex, game, dict):
def bundle(ex, game, arg_dict):
if ex["bundle"]["type"] == "python-script":
cmd = sys.executable + " scripts/" + ex["bundle"]["location"]
for key in ex["bundle"]["options"].keys():
Expand All @@ -40,7 +42,7 @@ def bundle(ex, game, dict):
if value == "$$packname":
cmd += ".zip" # temporary hack
elif len(value) >= 1 and value[0] == '$':
cmd += dict[value[1:]]
cmd += arg_dict[value[1:]]
else:
cmd += value

Expand All @@ -61,7 +63,7 @@ def main():

args = parser.parse_args()

dict = {"game_location": args.game_location,
arg_dict = {"game_location": args.game_location,
"binary_location": args.binary_location}

f = open('export-platforms.json')
Expand All @@ -74,10 +76,10 @@ def main():
if args.game in games:
print()
prepare(export_platforms[args.export_platform],
games[args.game], dict)
games[args.game], arg_dict)

bundle(export_platforms[args.export_platform],
games[args.game], dict)
games[args.game], arg_dict)

else:
print(
Expand Down

0 comments on commit df393af

Please sign in to comment.