BGE: Adding two new functions to bge.render to allow users to change the anisotropic...
[blender-staging.git] / build_files / buildbot / master_unpack.py
index f97e53384b0e613fcb9030dfaed2b37c26d55aeb..ad7c09933c69ad2058d4b0dcc366733ba988c28b 100644 (file)
@@ -43,9 +43,12 @@ def get_platform(filename):
     # platform out, but there may be some variations, so we fiddle a
     # bit to handle current and hopefully future names
     filename = strip_extension(filename)
+    filename = strip_extension(filename)
 
     tokens = filename.split("-")
-    platforms = 'osx', 'mac', 'bsd', 'win', 'linux', 'source', 'irix', 'solaris'
+    platforms = ('osx', 'mac', 'bsd',
+                 'win', 'linux', 'source',
+                 'irix', 'solaris')
     platform_tokens = []
     found = False
 
@@ -61,6 +64,22 @@ def get_platform(filename):
 
     return '-'.join(platform_tokens)
 
+
+def get_branch(filename):
+    tokens = filename.split("-")
+    branch = ""
+
+    for token in tokens:
+        if branch == "":
+            branch = token
+        else:
+            branch = branch + "-" + token
+
+        if token == "blender":
+            return branch
+
+    return ""
+
 # get filename
 if len(sys.argv) < 2:
     sys.stderr.write("Not enough arguments, expecting file to unpack\n")
@@ -86,19 +105,21 @@ if len(z.namelist()) != 1:
 package = z.namelist()[0]
 packagename = os.path.basename(package)
 
-# detect platform
+# detect platform and branch
 platform = get_platform(packagename)
+branch = get_branch(packagename)
 
 if platform == '':
-    sys.stderr.write('Failed to detect platform from package: %r\n' % packagename)
+    sys.stderr.write('Failed to detect platform ' +
+        'from package: %r\n' % packagename)
     sys.exit(1)
 
 # extract
-dir = 'public_html/download'
+directory = 'public_html/download'
 
 try:
     zf = z.open(package)
-    f = file(os.path.join(dir, packagename), "wb")
+    f = file(os.path.join(directory, packagename), "wb")
 
     shutil.copyfileobj(zf, f)
 
@@ -110,12 +131,12 @@ except Exception, ex:
     sys.stderr.write('Failed to unzip package: %s\n' % str(ex))
     sys.exit(1)
 
-# remove other files from the same platform
+# remove other files from the same platform and branch
 try:
-    for f in os.listdir(dir):
-        if platform.lower() in f.lower():
+    for f in os.listdir(directory):
+        if get_platform(f) == platform and get_branch(f) == branch:
             if f != packagename:
-                os.remove(os.path.join(dir, f))
+                os.remove(os.path.join(directory, f))
 except Exception, ex:
     sys.stderr.write('Failed to remove old packages: %s\n' % str(ex))
     sys.exit(1)