Fix handling of files that are not in subdirs.
Use raw strings for regex. Should fix #672.
This commit is contained in:
parent
2ef7828e93
commit
76b3565f7f
17
release.py
17
release.py
@ -37,25 +37,24 @@ def isJar(filename):
|
|||||||
# false if not
|
# false if not
|
||||||
def isValidCommitMessage(message):
|
def isValidCommitMessage(message):
|
||||||
if debug:
|
if debug:
|
||||||
print("Checking if {} matchs pattern ^\d+\.\d+\.\d+:".format(message))
|
print(r"Checking if {} matches pattern ^\d+\.\d+\.\d+:".format(message))
|
||||||
pattern = re.compile("^\d+\.\d+\.\d+:")
|
pattern = re.compile(r"^\d+\.\d+\.\d+:")
|
||||||
return re.match(pattern, message)
|
return re.match(pattern, message)
|
||||||
|
|
||||||
|
|
||||||
# Checks if the update has the name ripme.jar, if not it renames the file
|
# Checks if the update has the name ripme.jar, if not it renames the file
|
||||||
# Returns the update file path
|
def checkAndRenameFile(path):
|
||||||
# TODO handle files that aren't in sub dirs
|
"""Check if path (a string) points to a ripme.jar. Returns the possibly renamed file path"""
|
||||||
def renameFile(path):
|
|
||||||
if not path.endswith("ripme.jar"):
|
if not path.endswith("ripme.jar"):
|
||||||
print("Specified file is not named ripme.jar, renaming")
|
print("Specified file is not named ripme.jar, renaming")
|
||||||
# os.sep is the path separator for the os this is being run on
|
new_path = os.path.join(os.path.dirname(path), "ripme.jar")
|
||||||
os.rename(path, path.split(os.sep)[0] + os.sep + "ripme.jar")
|
os.rename(path, new_path)
|
||||||
return path.split(os.sep)[0] + os.sep + "ripme.jar"
|
return new_path
|
||||||
return path
|
return path
|
||||||
|
|
||||||
|
|
||||||
ripmeJson = json.loads(open("ripme.json").read())
|
ripmeJson = json.loads(open("ripme.json").read())
|
||||||
fileToUploadPath = renameFile(args.file)
|
fileToUploadPath = checkAndRenameFile(args.file)
|
||||||
InNoninteractiveMode = args.non_interactive
|
InNoninteractiveMode = args.non_interactive
|
||||||
commitMessage = ripmeJson.get("changeList")[0]
|
commitMessage = ripmeJson.get("changeList")[0]
|
||||||
releaseVersion = ripmeJson.get("latestVersion")
|
releaseVersion = ripmeJson.get("latestVersion")
|
||||||
|
Loading…
Reference in New Issue
Block a user