From 3e6b77b0409d05d5ed19c61e24246ed2a88b65e7 Mon Sep 17 00:00:00 2001 From: Sworddragon Date: Sat, 2 Apr 2011 04:47:19 +0200 Subject: [PATCH] Added/fixed directory changing --- scripts/build.py | 4 ++-- scripts/copyright.py | 4 ++-- scripts/make_release.py | 5 ++++- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/scripts/build.py b/scripts/build.py index 4e86d16b4..0fa0bd2b8 100644 --- a/scripts/build.py +++ b/scripts/build.py @@ -6,9 +6,9 @@ if sys.version_info[0] == 2: elif sys.version_info[0] == 3: import urllib.request url_lib = urllib.request -match = re.search("(.*?)/[^/]*?$", sys.argv[0]) +match = re.search('(.*)/', sys.argv[0]) if match != None: - os.chdir(os.getcwd() + "/" + match.group(1)) + os.chdir(match.group(1)) url_bam = "http://github.com/matricks/bam/zipball/master" url_teeworlds = "http://github.com/oy/teeworlds/zipball/master" diff --git a/scripts/copyright.py b/scripts/copyright.py index 29e1bbfef..fade0b139 100755 --- a/scripts/copyright.py +++ b/scripts/copyright.py @@ -1,7 +1,7 @@ import os, re, sys -match = re.search("(.*?)/[^/]*?$", sys.argv[0]) +match = re.search('(.*)/', sys.argv[0]) if match != None: - os.chdir(os.getcwd() + "/" + match.group(1)) + os.chdir(match.group(1)) notice = [b"/* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */\n", b"/* If you are missing that file, acquire a complete release at teeworlds.com. */\n"] exclude = ["../src%sengine%sexternal" % (os.sep, os.sep), "../src%sosxlaunch" % os.sep] diff --git a/scripts/make_release.py b/scripts/make_release.py index f9ff9e943..b056bc4ed 100644 --- a/scripts/make_release.py +++ b/scripts/make_release.py @@ -1,4 +1,7 @@ -import shutil, os, sys, zipfile +import shutil, os, re, sys, zipfile +match = re.search('(.*)/', sys.argv[0]) +if match != None: + os.chdir(match.group(1)) #valid_platforms = ["win32", "linux86", "linux86_64", "src"]