[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [41422] trunk/blender/build_files/cmake: name qtcreator projects based on branch names ( if svn is found and its a branch), was too confusing with multiple IDE' s open calling all projects 'Blender'.

Campbell Barton ideasman42 at gmail.com
Tue Nov 1 03:24:42 CET 2011


Revision: 41422
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=41422
Author:   campbellbarton
Date:     2011-11-01 02:24:40 +0000 (Tue, 01 Nov 2011)
Log Message:
-----------
name qtcreator projects based on branch names (if svn is found and its a branch), was too confusing with multiple IDE's open calling all projects 'Blender'.

Modified Paths:
--------------
    trunk/blender/build_files/cmake/cmake_qtcreator_project.py
    trunk/blender/build_files/cmake/project_info.py

Modified: trunk/blender/build_files/cmake/cmake_qtcreator_project.py
===================================================================
--- trunk/blender/build_files/cmake/cmake_qtcreator_project.py	2011-11-01 02:01:09 UTC (rev 41421)
+++ trunk/blender/build_files/cmake/cmake_qtcreator_project.py	2011-11-01 02:24:40 UTC (rev 41422)
@@ -40,6 +40,7 @@
                           is_py,
                           cmake_advanced_info,
                           cmake_compiler_defines,
+                          project_name_get,
                           )
 
 import os
@@ -59,7 +60,8 @@
         f.write("\n".join(files_rel))
 
         f = open(os.path.join(PROJECT_DIR, "%s.includes" % PROJECT_NAME), 'w')
-        f.write("\n".join(sorted(list(set(os.path.dirname(f) for f in files_rel if is_c_header(f))))))
+        f.write("\n".join(sorted(list(set(os.path.dirname(f)
+                          for f in files_rel if is_c_header(f))))))
 
         qtc_prj = os.path.join(PROJECT_DIR, "%s.creator" % PROJECT_NAME)
         f = open(qtc_prj, 'w')
@@ -73,10 +75,16 @@
         includes, defines = cmake_advanced_info()
 
         # for some reason it doesnt give all internal includes
-        includes = list(set(includes) | set(os.path.dirname(f) for f in files_rel if is_c_header(f)))
+        includes = list(set(includes) | set(os.path.dirname(f)
+                        for f in files_rel if is_c_header(f)))
         includes.sort()
 
-        PROJECT_NAME = "Blender"
+        if 0:
+            PROJECT_NAME = "Blender"
+        else:
+            # be tricky, get the project name from SVN if we can!
+            PROJECT_NAME = project_name_get(SOURCE_DIR)
+
         FILE_NAME = PROJECT_NAME.lower()
         f = open(os.path.join(PROJECT_DIR, "%s.files" % FILE_NAME), 'w')
         f.write("\n".join(files_rel))
@@ -93,7 +101,7 @@
         f.write("// ADD PREDEFINED MACROS HERE!\n")
         defines_final = [("#define %s %s" % item) for item in defines]
         if sys.platform != "win32":
-            defines_final += cmake_compiler_defines()  # defines from the compiler
+            defines_final += cmake_compiler_defines()
         f.write("\n".join(defines_final))
 
     print("Blender project file written to: %s" % qtc_prj)
@@ -106,7 +114,12 @@
     files_rel.sort()
 
     # --- qtcreator specific, simple format
-    PROJECT_NAME = "Blender_Python"
+    if 0:
+        PROJECT_NAME = "Blender_Python"
+    else:
+        # be tricky, get the project name from SVN if we can!
+        PROJECT_NAME = project_name_get(SOURCE_DIR) + "_Python"
+
     FILE_NAME = PROJECT_NAME.lower()
     f = open(os.path.join(PROJECT_DIR, "%s.files" % FILE_NAME), 'w')
     f.write("\n".join(files_rel))

Modified: trunk/blender/build_files/cmake/project_info.py
===================================================================
--- trunk/blender/build_files/cmake/project_info.py	2011-11-01 02:01:09 UTC (rev 41421)
+++ trunk/blender/build_files/cmake/project_info.py	2011-11-01 02:24:40 UTC (rev 41422)
@@ -41,6 +41,7 @@
     "is_py",
     "cmake_advanced_info",
     "cmake_compiler_defines",
+    "project_name_get"
 )
 
 import sys
@@ -215,3 +216,22 @@
     os.remove(temp_c)
     os.remove(temp_def)
     return lines
+
+
+def project_name_get(path, fallback="Blender", prefix="Blender_"):
+    if not os.path.isdir(os.path.join(path, ".svn")):
+        return fallback
+
+    import subprocess
+    info = subprocess.Popen(["svn", "info", path],
+                            stdout=subprocess.PIPE).communicate()[0].decode()
+
+    for l in info.split("\n"):
+        l = l.strip()
+        if l.startswith("URL"):
+            # https://svn.blender.org/svnroot/bf-blender/branches/bmesh/blender
+            # --> bmesh
+            if "/branches/" in l:
+                return prefix + l.rsplit("/branches/", 1)[-1].split("/", 1)[0]
+    return fallback
+




More information about the Bf-blender-cvs mailing list