py3: Update the distribute script to work under Python 3.
This commit is contained in:
+19
-14
@@ -1,7 +1,11 @@
|
||||
#!/home/tom/ab/renpy/lib/py2-linux-x86_64/python -O
|
||||
|
||||
# Builds a distribution of Ren'Py.
|
||||
from __future__ import print_function
|
||||
from __future__ import division, absolute_import, with_statement, print_function, unicode_literals
|
||||
|
||||
import future.standard_library
|
||||
import future.utils
|
||||
PY2 = future.utils.PY2
|
||||
|
||||
import sys
|
||||
import os
|
||||
@@ -11,18 +15,15 @@ import subprocess
|
||||
import argparse
|
||||
import time
|
||||
|
||||
|
||||
try:
|
||||
# reload is built-in in Python 2, in importlib in Python 3
|
||||
reload
|
||||
except NameError:
|
||||
from importlib import reload
|
||||
|
||||
if not sys.flags.optimize:
|
||||
raise Exception("Optimization disabled.")
|
||||
|
||||
ROOT = os.path.dirname(os.path.abspath(__file__))
|
||||
|
||||
|
||||
def copy_tutorial_file(src, dest):
|
||||
"""
|
||||
Copies a file from src to dst. Lines between "# tutorial-only" and
|
||||
@@ -47,7 +48,7 @@ def main():
|
||||
|
||||
start = time.time()
|
||||
|
||||
if not sys.flags.optimize:
|
||||
if PY2 and not sys.flags.optimize:
|
||||
raise Exception("Not running with python optimization.")
|
||||
|
||||
ap = argparse.ArgumentParser()
|
||||
@@ -78,16 +79,20 @@ def main():
|
||||
|
||||
match_version = ".".join(str(i) for i in renpy.version_tuple[:2]) # @UndefinedVariable
|
||||
|
||||
s = subprocess.check_output([ "git", "describe", "--tags", "--dirty", "--match", "start-" + match_version ])
|
||||
parts = s.strip().split("-")
|
||||
try:
|
||||
s = subprocess.check_output([ "git", "describe", "--tags", "--dirty", "--match", "start-" + match_version ])
|
||||
parts = s.strip().split("-")
|
||||
|
||||
if len(parts) <= 3:
|
||||
if len(parts) <= 3:
|
||||
vc_version = 0
|
||||
else:
|
||||
vc_version = int(parts[2])
|
||||
|
||||
if parts[-1] == "dirty":
|
||||
vc_version += 1
|
||||
|
||||
except subprocess.CalledProcessError:
|
||||
vc_version = 0
|
||||
else:
|
||||
vc_version = int(parts[2])
|
||||
|
||||
if parts[-1] == "dirty":
|
||||
vc_version += 1
|
||||
|
||||
with open("renpy/vc_version.py", "w") as f:
|
||||
import socket
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
import argparse
|
||||
import rsa
|
||||
import base64
|
||||
|
||||
ap = argparse.ArgumentParser()
|
||||
ap.add_argument("private")
|
||||
@@ -18,4 +19,4 @@ with open(args.json, "rb") as f:
|
||||
signature = rsa.sign(message, private, "SHA-256")
|
||||
|
||||
with open(args.json + ".sig", "wb") as f:
|
||||
f.write(signature.encode("base64"))
|
||||
f.write(base64.b64encode(signature))
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user