Skip to content

Commit 6113828

Browse files
committed
made changes to make it compatible with python 3
1 parent 74cd711 commit 6113828

101 files changed

Lines changed: 15911 additions & 409 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.vscode/settings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"python.formatting.provider": "black"
3+
}

build.py

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
See the License for the specific language governing permissions and
1515
limitations under the License.
1616
"""
17+
from __future__ import print_function
1718
from datetime import datetime
1819
from glob import glob
1920
import logging
@@ -49,11 +50,11 @@
4950
def load_properties(prop_dict, prop_file):
5051
"This function loads standard, java-style properties files into a dictionary."
5152
if os.path.exists(prop_file):
52-
print "Reading property file " + prop_file
53+
print("Reading property file " + prop_file)
5354
[prop_dict.update({prop.split("=")[0].strip(): prop.split("=")[1].strip()})
5455
for prop in open(prop_file).readlines() if not (prop.startswith("#") or prop.strip() == "")]
5556
else:
56-
print "Unable to read property file " + prop_file
57+
print("Unable to read property file " + prop_file)
5758

5859
# Override defaults with a properties file
5960
load_properties(p, "springpython.properties")
@@ -65,22 +66,22 @@ def load_properties(prop_dict, prop_file):
6566

6667
def usage():
6768
"""This function is used to print out help either by request, or if an invalid option is used."""
68-
print
69-
print "Usage: python build.py [command]"
70-
print
71-
print "\t--help\t\t\tprint this help message"
72-
print "\t--clean\t\t\tclean out this build by deleting the %s directory" % p["targetDir"]
73-
print "\t--test\t\t\trun the test suite, leaving all artifacts in %s" % p["testDir"]
74-
print "\t--suite [suite]\t\trun a specific test suite, leaving all artifacts in %s" % p["testDir"]
75-
print "\t--coverage\t\trun the test suite with coverage analysis, leaving all artifacts in %s" % p["testDir"]
76-
print "\t--debug-level [info|debug]\n\t\t\t\tthreshold of logging message when running tests or coverage analysis"
77-
print "\t--package\t\tpackage everything up into a tarball for release to sourceforge in %s" % p["packageDir"]
78-
print "\t--build-stamp [tag]\tfor --package, this specifies a special tag, generating version tag '%s.<tag>. springpython.properties can override with build.stamp'" % p["version"]
79-
print "\t\t\t\tIf this option isn't used, default will be tag will be '%s.<current time>'" % p["version"]
80-
print "\t--register\t\tregister this release with http://pypi.python.org/pypi"
81-
print "\t--docs-sphinx\t\tgenerate Sphinx documentation"
82-
print "\t--pydoc\t\t\tgenerate pydoc information"
83-
print
69+
print()
70+
print("Usage: python build.py [command]")
71+
print()
72+
print("\t--help\t\t\tprint this help message")
73+
print("\t--clean\t\t\tclean out this build by deleting the %s directory" % p["targetDir"])
74+
print("\t--test\t\t\trun the test suite, leaving all artifacts in %s" % p["testDir"])
75+
print("\t--suite [suite]\t\trun a specific test suite, leaving all artifacts in %s" % p["testDir"])
76+
print("\t--coverage\t\trun the test suite with coverage analysis, leaving all artifacts in %s" % p["testDir"])
77+
print("\t--debug-level [info|debug]\n\t\t\t\tthreshold of logging message when running tests or coverage analysis")
78+
print("\t--package\t\tpackage everything up into a tarball for release to sourceforge in %s" % p["packageDir"])
79+
print("\t--build-stamp [tag]\tfor --package, this specifies a special tag, generating version tag '%s.<tag>. springpython.properties can override with build.stamp'" % p["version"])
80+
print("\t\t\t\tIf this option isn't used, default will be tag will be '%s.<current time>'" % p["version"])
81+
print("\t--register\t\tregister this release with http://pypi.python.org/pypi")
82+
print("\t--docs-sphinx\t\tgenerate Sphinx documentation")
83+
print("\t--pydoc\t\t\tgenerate pydoc information")
84+
print()
8485

8586
try:
8687
optlist, args = getopt.getopt(sys.argv[1:],
@@ -89,7 +90,7 @@ def usage():
8990
"register", "docs-sphinx", "pydoc"])
9091
except getopt.GetoptError:
9192
# print help information and exit:
92-
print "Invalid command found in %s" % sys.argv
93+
print("Invalid command found in %s" % sys.argv)
9394
usage()
9495
sys.exit(2)
9596

@@ -105,7 +106,7 @@ def usage():
105106
############################################################################
106107

107108
def clean(dir):
108-
print "Removing '%s' directory" % dir
109+
print("Removing '%s' directory" % dir)
109110
if os.path.exists(".coverage"):
110111
os.remove(".coverage")
111112
if os.path.exists(dir):
@@ -205,7 +206,7 @@ def package(dir, version, s3bucket, src_filename, sample_filename):
205206
os.makedirs(dir)
206207

207208
_substitute("src/plugins/coily-template", "src/plugins/coily", [("version", version)])
208-
os.chmod("src/plugins/coily", 0755)
209+
os.chmod("src/plugins/coily", 0o755)
209210
build("src", version, s3bucket, src_filename)
210211
build("samples", version, s3bucket, sample_filename)
211212
#os.remove("src/plugins/coily")
@@ -232,7 +233,7 @@ def register():
232233

233234
def copy(src, dest, patterns):
234235
if not os.path.exists(dest):
235-
print "+++ Creating " + dest
236+
print("+++ Creating " + dest)
236237
os.makedirs(dest)
237238

238239
[shutil.copy(file, dest) for pattern in patterns for file in glob(src + pattern)]
@@ -317,7 +318,7 @@ def create_pydocs():
317318

318319
for file in os.listdir("."):
319320
if "springpython" not in file: continue
320-
print "Altering appearance of %s" % file
321+
print("Altering appearance of %s" % file)
321322
file_input = open(file).read()
322323
file_input = re.compile(top_color).sub("GREEN", file_input)
323324
file_input = re.compile(pkg_color).sub("GREEN", file_input)
@@ -375,11 +376,11 @@ def create_pydocs():
375376
clean(p["targetDir"])
376377

377378
if option[0] in ("--test"):
378-
print "Running checkin tests..."
379+
print("Running checkin tests...")
379380
test(p["testDir"], "checkin", debug_level)
380381

381382
if option[0] in ("--suite"):
382-
print "Running test suite %s..." % option[1]
383+
print("Running test suite %s..." % option[1])
383384
test(p["testDir"], option[1], debug_level)
384385

385386
if option[0] in ("--coverage"):

0 commit comments

Comments
 (0)