mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
update make_release.py
This commit is contained in:
parent
85f2cebfaf
commit
f08f143fe7
|
@ -1,10 +1,4 @@
|
|||
import shutil, os, re, sys, zipfile
|
||||
if sys.version_info[0] == 2:
|
||||
import urllib
|
||||
url_lib = urllib
|
||||
elif sys.version_info[0] == 3:
|
||||
import urllib.request
|
||||
url_lib = urllib.request
|
||||
import shutil, os, sys, zipfile
|
||||
|
||||
#valid_platforms = ["win32", "linux86", "linux86_64", "src"]
|
||||
|
||||
|
@ -14,7 +8,6 @@ if len(sys.argv) != 3:
|
|||
sys.exit(-1)
|
||||
|
||||
name = "DDRace"
|
||||
url_languages = "https://github.com/teeworlds/teeworlds-translation/zipball/master"
|
||||
version = sys.argv[1]
|
||||
platform = sys.argv[2]
|
||||
exe_ext = ""
|
||||
|
@ -47,29 +40,6 @@ if platform == 'osx':
|
|||
use_gz = 0
|
||||
use_bundle = 1
|
||||
|
||||
def fetch_file(url):
|
||||
try:
|
||||
print("trying %s" % url)
|
||||
real_url = url_lib.urlopen(url).geturl()
|
||||
local = real_url.split("/")
|
||||
local = local[len(local)-1].split("?")
|
||||
local = local[0]
|
||||
url_lib.urlretrieve(real_url, local)
|
||||
return local
|
||||
except:
|
||||
return False
|
||||
|
||||
def unzip(filename, where):
|
||||
try:
|
||||
z = zipfile.ZipFile(filename, "r")
|
||||
except:
|
||||
return False
|
||||
for name in z.namelist():
|
||||
if "/data/languages/" in name:
|
||||
z.extract(name, where)
|
||||
z.close()
|
||||
return z.namelist()[0]
|
||||
|
||||
def copydir(src, dst, excl=[]):
|
||||
for root, dirs, files in os.walk(src, topdown=True):
|
||||
if "/." in root or "\\." in root:
|
||||
|
@ -81,14 +51,6 @@ def copydir(src, dst, excl=[]):
|
|||
if name[0] != '.':
|
||||
shutil.copy(os.path.join(root, name), os.path.join(dst, root, name))
|
||||
|
||||
def clean():
|
||||
print("*** cleaning ***")
|
||||
try:
|
||||
shutil.rmtree(package_dir)
|
||||
shutil.rmtree(languages_dir)
|
||||
os.remove(src_package_languages)
|
||||
except: pass
|
||||
|
||||
package = "%s-%s-%s" %(name, version, platform)
|
||||
package_dir = package
|
||||
|
||||
|
@ -96,16 +58,6 @@ print("cleaning target")
|
|||
shutil.rmtree(package_dir, True)
|
||||
os.mkdir(package_dir)
|
||||
|
||||
print("download and extract languages")
|
||||
src_package_languages = fetch_file(url_languages)
|
||||
if not src_package_languages:
|
||||
print("couldn't download languages")
|
||||
sys.exit(-1)
|
||||
languages_dir = unzip(src_package_languages, ".")
|
||||
if not languages_dir:
|
||||
print("couldn't unzip languages")
|
||||
sys.exit(-1)
|
||||
|
||||
print("adding files")
|
||||
shutil.copy("readme.txt", package_dir)
|
||||
shutil.copy("license.txt", package_dir)
|
||||
|
@ -118,12 +70,6 @@ shutil.copy("license_DDRace.txt", package_dir)
|
|||
if include_data and not use_bundle:
|
||||
os.mkdir(os.path.join(package_dir, "data"))
|
||||
copydir("data", package_dir)
|
||||
try:
|
||||
os.chdir(languages_dir)
|
||||
copydir("data", "../"+package_dir)
|
||||
os.chdir("..")
|
||||
except:
|
||||
print("couldn't find languages")
|
||||
if platform[:3] == "win":
|
||||
shutil.copy("other/config_directory.bat", package_dir)
|
||||
shutil.copy("SDL.dll", package_dir)
|
||||
|
@ -167,9 +113,8 @@ if use_bundle:
|
|||
os.mkdir(clientbundle_framework_dir)
|
||||
os.mkdir(os.path.join(clientbundle_resource_dir, "data"))
|
||||
copydir("data", clientbundle_resource_dir)
|
||||
os.chdir(languages_dir)
|
||||
copydir("data", "../"+clientbundle_resource_dir)
|
||||
os.chdir("..") # TODO(GreYFoX): make sure this line doesn't change the directory of the icon file copied next, just make sure everything works
|
||||
|
||||
|
||||
shutil.copy("other/icons/DDRace.icns", clientbundle_resource_dir)
|
||||
#shutil.copy("other/icons/Teeworlds.icns", clientbundle_resource_dir)
|
||||
shutil.copy(name+exe_ext, clientbundle_bin_dir)
|
||||
|
@ -221,7 +166,7 @@ if use_bundle:
|
|||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>English</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>DDRace_Server</string>
|
||||
<string>DDRace-Server</string>
|
||||
<key>CFBundleIconFile</key>
|
||||
<string>DDRace-Server</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
|
@ -259,6 +204,4 @@ if use_dmg:
|
|||
os.system("hdiutil convert %s_temp.dmg -format UDBZ -o %s.dmg -quiet" % (package, package))
|
||||
os.system("rm -f %s_temp.dmg" % package)
|
||||
|
||||
clean()
|
||||
|
||||
print("done")
|
||||
|
|
Loading…
Reference in a new issue