Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2011-05-16 08:04:06 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-05-16 08:04:06 +0400
commit0460a68ae7d2ef7f771c407dd5b9f9c86d2c8d49 (patch)
tree86b354d8ac07731238e0483b49424b4c66c43a9f /build_files
parent7459133648b878fa4842367cebec5deb7489558d (diff)
made generic module for generating project files from cmake,
added netbeans project file generator.
Diffstat (limited to 'build_files')
-rwxr-xr-xbuild_files/cmake/cmake_netbeans_project.py227
-rw-r--r--build_files/cmake/cmake_qtcreator_project.py176
-rw-r--r--build_files/cmake/project_info.py218
3 files changed, 450 insertions, 171 deletions
diff --git a/build_files/cmake/cmake_netbeans_project.py b/build_files/cmake/cmake_netbeans_project.py
new file mode 100755
index 00000000000..7709bac12e6
--- /dev/null
+++ b/build_files/cmake/cmake_netbeans_project.py
@@ -0,0 +1,227 @@
+#!/usr/bin/env python
+
+# $Id:
+# ***** BEGIN GPL LICENSE BLOCK *****
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# Contributor(s): Campbell Barton, M.G. Kishalmi
+#
+# ***** END GPL LICENSE BLOCK *****
+
+# <pep8 compliant>
+
+"""
+Example linux usage
+ python .~/blenderSVN/blender/build_files/cmake/cmake_netbeans_project.py ~/blenderSVN/cmake
+
+Windows not supported so far
+"""
+
+from project_info import *
+
+import os
+from os.path import join, dirname, normpath, abspath, splitext, relpath, exists
+
+
+def create_nb_project_main():
+ files = list(source_list(SOURCE_DIR, filename_check=is_project_file))
+ files_rel = [relpath(f, start=PROJECT_DIR) for f in files]
+ files_rel.sort()
+
+ if SIMPLE_PROJECTFILE:
+ pass
+ else:
+ includes, defines = cmake_advanced_info()
+ # for some reason it doesnt give all internal includes
+ includes = list(set(includes) | set(dirname(f) for f in files if is_c_header(f)))
+ includes.sort()
+
+ PROJECT_NAME = "Blender"
+ FILE_NAME = PROJECT_NAME.lower()
+
+ # --------------- NB spesific
+ defines = [("%s=%s" % cdef) if cdef[1] else cdef[0] for cdef in defines]
+ defines += [cdef.replace("#define", "").strip() for cdef in cmake_compiler_defines()]
+
+ def file_list_to_nested(files):
+ # convert paths to hierarchy
+ paths_nested = {}
+
+ def ensure_path(filepath):
+ filepath_split = filepath.split(os.sep)
+
+ pn = paths_nested
+ for subdir in filepath_split[:-1]:
+ pn = pn.setdefault(subdir, {})
+ pn[filepath_split[-1]] = None
+
+ for path in files:
+ ensure_path(path)
+ return paths_nested
+
+ PROJECT_DIR_NB = join(PROJECT_DIR, "nbproject")
+ if not exists(PROJECT_DIR_NB):
+ os.mkdir(PROJECT_DIR_NB)
+
+ SOURCE_DIR_REL = relpath(SOURCE_DIR, PROJECT_DIR)
+
+ f = open(join(PROJECT_DIR_NB, "project.xml"), 'w')
+
+ f.write('<?xml version="1.0" encoding="UTF-8"?>\n')
+ f.write('<project xmlns="http://www.netbeans.org/ns/project/1">\n')
+ f.write(' <type>org.netbeans.modules.cnd.makeproject</type>\n')
+ f.write(' <configuration>\n')
+ f.write(' <data xmlns="http://www.netbeans.org/ns/make-project/1">\n')
+ f.write(' <name>%s</name>\n' % PROJECT_NAME)
+ f.write(' <c-extensions>c,m</c-extensions>\n')
+ f.write(' <cpp-extensions>cpp,mm</cpp-extensions>\n')
+ f.write(' <header-extensions>h,hpp,inl</header-extensions>\n')
+ f.write(' <sourceEncoding>UTF-8</sourceEncoding>\n')
+ f.write(' <make-dep-projects/>\n')
+ f.write(' <sourceRootList>\n')
+ f.write(' <sourceRootElem>%s</sourceRootElem>\n' % SOURCE_DIR) # base_root_rel
+ f.write(' </sourceRootList>\n')
+ f.write(' <confList>\n')
+ f.write(' <confElem>\n')
+ f.write(' <name>Default</name>\n')
+ f.write(' <type>0</type>\n')
+ f.write(' </confElem>\n')
+ f.write(' </confList>\n')
+ f.write(' </data>\n')
+ f.write(' </configuration>\n')
+ f.write('</project>\n')
+
+ f = open(join(PROJECT_DIR_NB, "configurations.xml"), 'w')
+
+ f.write('<?xml version="1.0" encoding="UTF-8"?>\n')
+ f.write('<configurationDescriptor version="79">\n')
+ f.write(' <logicalFolder name="root" displayName="root" projectFiles="true" kind="ROOT">\n')
+ f.write(' <df name="blender" root="%s">\n' % SOURCE_DIR) # base_root_rel
+
+ # write files!
+ files_rel_local = [normpath(relpath(join(CMAKE_DIR, path), SOURCE_DIR)) for path in files_rel]
+ files_rel_hierarchy = file_list_to_nested(files_rel_local)
+ # print(files_rel_hierarchy)
+
+ def write_df(hdir, ident):
+ dirs = []
+ files = []
+ for key, item in sorted(hdir.items()):
+ if item is None:
+ files.append(key)
+ else:
+ dirs.append((key, item))
+
+ for key, item in dirs:
+ f.write('%s <df name="%s">\n' % (ident, key))
+ write_df(item, ident + " ")
+ f.write('%s </df>\n' % ident)
+
+ for key in files:
+ f.write('%s<in>%s</in>\n' % (ident, key))
+
+ write_df(files_rel_hierarchy, ident=" ")
+
+ f.write(' </df>\n')
+
+ f.write(' <logicalFolder name="ExternalFiles"\n')
+ f.write(' displayName="Important Files"\n')
+ f.write(' projectFiles="false"\n')
+ f.write(' kind="IMPORTANT_FILES_FOLDER">\n')
+ # f.write(' <itemPath>../GNUmakefile</itemPath>\n')
+ f.write(' </logicalFolder>\n')
+
+ f.write(' </logicalFolder>\n')
+ f.write(' <sourceFolderFilter>^(nbproject)$</sourceFolderFilter>\n')
+ f.write(' <sourceRootList>\n')
+ f.write(' <Elem>%s</Elem>\n' % SOURCE_DIR) # base_root_rel
+ f.write(' </sourceRootList>\n')
+
+ f.write(' <projectmakefile>Makefile</projectmakefile>\n')
+
+ # paths again
+ f.write(' <confs>\n')
+ f.write(' <conf name="Default" type="0">\n')
+
+ f.write(' <toolsSet>\n')
+ f.write(' <remote-sources-mode>LOCAL_SOURCES</remote-sources-mode>\n')
+ f.write(' <compilerSet>default</compilerSet>\n')
+ f.write(' </toolsSet>\n')
+ f.write(' <makefileType>\n')
+
+ f.write(' <makeTool>\n')
+ f.write(' <buildCommandWorkingDir>.</buildCommandWorkingDir>\n')
+ f.write(' <buildCommand>${MAKE} -f Makefile</buildCommand>\n')
+ f.write(' <cleanCommand>${MAKE} -f Makefile clean</cleanCommand>\n')
+ f.write(' <executablePath>./bin/blender</executablePath>\n')
+
+ def write_toolinfo():
+ f.write(' <incDir>\n')
+ for inc in includes:
+ f.write(' <pElem>%s</pElem>\n' % inc)
+ f.write(' </incDir>\n')
+ f.write(' <preprocessorList>\n')
+ for cdef in defines:
+ f.write(' <Elem>%s</Elem>\n' % cdef)
+ f.write(' </preprocessorList>\n')
+
+ f.write(' <cTool>\n')
+ write_toolinfo()
+ f.write(' </cTool>\n')
+
+ f.write(' <ccTool>\n')
+ write_toolinfo()
+ f.write(' </ccTool>\n')
+
+ f.write(' </makeTool>\n')
+ f.write(' </makefileType>\n')
+ # finishe makefle info
+
+ f.write(' \n')
+
+ for path in files_rel_local:
+ f.write(' <item path="%s"\n' % path)
+ f.write(' ex="false"\n')
+ f.write(' tool="1"\n')
+ f.write(' flavor="0">\n')
+ f.write(' </item>\n')
+
+ f.write(' <runprofile version="9">\n')
+ f.write(' <runcommandpicklist>\n')
+ f.write(' </runcommandpicklist>\n')
+ f.write(' <runcommand>%s</runcommand>\n' % os.path.join(CMAKE_DIR, "bin/blender"))
+ f.write(' <rundir>%s</rundir>\n' % SOURCE_DIR)
+ f.write(' <buildfirst>false</buildfirst>\n')
+ f.write(' <terminal-type>0</terminal-type>\n')
+ f.write(' <remove-instrumentation>0</remove-instrumentation>\n')
+ f.write(' <environment>\n')
+ f.write(' </environment>\n')
+ f.write(' </runprofile>\n')
+
+ f.write(' </conf>\n')
+ f.write(' </confs>\n')
+
+ # todo
+
+ f.write('</configurationDescriptor>\n')
+
+
+def main():
+ create_nb_project_main()
+
+
+if __name__ == "__main__":
+ main()
diff --git a/build_files/cmake/cmake_qtcreator_project.py b/build_files/cmake/cmake_qtcreator_project.py
index 59b8b2a3b02..2159f34ae76 100644
--- a/build_files/cmake/cmake_qtcreator_project.py
+++ b/build_files/cmake/cmake_qtcreator_project.py
@@ -31,182 +31,16 @@ example linux usage
python .~/blenderSVN/blender/build_files/cmake/cmake_qtcreator_project.py ~/blenderSVN/cmake
"""
-import sys
+from project_info import *
+
import os
from os.path import join, dirname, normpath, abspath, splitext, relpath, exists
-base = join(os.path.dirname(__file__), "..", "..")
-base = normpath(base)
-base = abspath(base)
-
-SIMPLE_PROJECTFILE = False
-
-# get cmake path
-CMAKE_DIR = sys.argv[-1]
-
-if not os.path.exists(os.path.join(CMAKE_DIR, "CMakeCache.txt")):
- CMAKE_DIR = os.getcwd()
-if not os.path.exists(os.path.join(CMAKE_DIR, "CMakeCache.txt")):
- print("CMakeCache.txt not found in %r or %r\n Pass CMake build dir as an argument, or run from that dir, aborting" % (CMAKE_DIR, os.getcwd()))
- sys.exit(1)
-
-
-# could be either.
-# PROJECT_DIR = base
-PROJECT_DIR = CMAKE_DIR
-
-
-def source_list(path, filename_check=None):
- for dirpath, dirnames, filenames in os.walk(path):
-
- # skip '.svn'
- if dirpath.startswith("."):
- continue
-
- for filename in filenames:
- filepath = join(dirpath, filename)
- if filename_check is None or filename_check(filepath):
- yield filepath
-
-
-# extension checking
-def is_cmake(filename):
- ext = splitext(filename)[1]
- return (ext == ".cmake") or (filename.endswith("CMakeLists.txt"))
-
-
-def is_c_header(filename):
- ext = splitext(filename)[1]
- return (ext in (".h", ".hpp", ".hxx"))
-
-
-def is_py(filename):
- ext = splitext(filename)[1]
- return (ext == ".py")
-
-
-def is_glsl(filename):
- ext = splitext(filename)[1]
- return (ext == ".glsl")
-
-
-def is_c(filename):
- ext = splitext(filename)[1]
- return (ext in (".c", ".cpp", ".cxx", ".m", ".mm", ".rc"))
-
-
-def is_c_any(filename):
- return is_c(filename) or is_c_header(filename)
-
-
-def is_svn_file(filename):
- dn, fn = os.path.split(filename)
- filename_svn = join(dn, ".svn", "text-base", "%s.svn-base" % fn)
- return exists(filename_svn)
-
-
-def is_project_file(filename):
- return (is_c_any(filename) or is_cmake(filename) or is_glsl(filename)) # and is_svn_file(filename)
-
-
-def cmake_advanced_info():
- """ Extracr includes and defines from cmake.
- """
-
- def create_eclipse_project(CMAKE_DIR):
- print("CMAKE_DIR %r" % CMAKE_DIR)
- if sys.platform == "win32":
- cmd = 'cmake "%s" -G"Eclipse CDT4 - MinGW Makefiles"' % CMAKE_DIR
- else:
- cmd = 'cmake "%s" -G"Eclipse CDT4 - Unix Makefiles"' % CMAKE_DIR
-
- os.system(cmd)
-
- includes = []
- defines = []
-
- create_eclipse_project(CMAKE_DIR)
-
- from xml.dom.minidom import parse
- tree = parse(os.path.join(CMAKE_DIR, ".cproject"))
- '''
- f = open(".cproject_pretty", 'w')
- f.write(tree.toprettyxml(indent=" ", newl=""))
- '''
- ELEMENT_NODE = tree.ELEMENT_NODE
-
- cproject, = tree.getElementsByTagName("cproject")
- for storage in cproject.childNodes:
- if storage.nodeType != ELEMENT_NODE:
- continue
-
- if storage.attributes["moduleId"].value == "org.eclipse.cdt.core.settings":
- cconfig = storage.getElementsByTagName("cconfiguration")[0]
- for substorage in cconfig.childNodes:
- if substorage.nodeType != ELEMENT_NODE:
- continue
-
- moduleId = substorage.attributes["moduleId"].value
-
- # org.eclipse.cdt.core.settings
- # org.eclipse.cdt.core.language.mapping
- # org.eclipse.cdt.core.externalSettings
- # org.eclipse.cdt.core.pathentry
- # org.eclipse.cdt.make.core.buildtargets
-
- if moduleId == "org.eclipse.cdt.core.pathentry":
- for path in substorage.childNodes:
- if path.nodeType != ELEMENT_NODE:
- continue
- kind = path.attributes["kind"].value
-
- if kind == "mac":
- # <pathentry kind="mac" name="PREFIX" path="" value="&quot;/opt/blender25&quot;"/>
- defines.append((path.attributes["name"].value, path.attributes["value"].value))
- elif kind == "inc":
- # <pathentry include="/data/src/blender/blender/source/blender/editors/include" kind="inc" path="" system="true"/>
- includes.append(path.attributes["include"].value)
- else:
- pass
-
- return includes, defines
-
-
-def cmake_cache_var(var):
- cache_file = open(os.path.join(CMAKE_DIR, "CMakeCache.txt"))
- lines = [l_strip for l in cache_file for l_strip in (l.strip(),) if l_strip if not l_strip.startswith("//") if not l_strip.startswith("#")]
- cache_file.close()
-
- for l in lines:
- if l.split(":")[0] == var:
- return l.split("=", 1)[-1]
- return None
-
-
-def cmake_compiler_defines():
- compiler = cmake_cache_var("CMAKE_C_COMPILER") # could do CXX too
-
- if compiler is None:
- print("Couldn't find the compiler, os defines will be omitted...")
- return
-
- import tempfile
- temp_c = tempfile.mkstemp(suffix=".c")[1]
- temp_def = tempfile.mkstemp(suffix=".def")[1]
-
- os.system("%s -dM -E %s > %s" % (compiler, temp_c, temp_def))
-
- temp_def_file = open(temp_def)
- lines = [l.strip() for l in temp_def_file if l.strip()]
- temp_def_file.close()
-
- os.remove(temp_c)
- os.remove(temp_def)
- return lines
+import sys
def create_qtc_project_main():
- files = list(source_list(base, filename_check=is_project_file))
+ files = list(source_list(SOURCE_DIR, filename_check=is_project_file))
files_rel = [relpath(f, start=PROJECT_DIR) for f in files]
files_rel.sort()
@@ -260,7 +94,7 @@ def create_qtc_project_main():
def create_qtc_project_python():
- files = list(source_list(base, filename_check=is_py))
+ files = list(source_list(SOURCE_DIR, filename_check=is_py))
files_rel = [relpath(f, start=PROJECT_DIR) for f in files]
files_rel.sort()
diff --git a/build_files/cmake/project_info.py b/build_files/cmake/project_info.py
new file mode 100644
index 00000000000..77b9cff21f2
--- /dev/null
+++ b/build_files/cmake/project_info.py
@@ -0,0 +1,218 @@
+#!/usr/bin/env python
+
+# $Id:
+# ***** BEGIN GPL LICENSE BLOCK *****
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# Contributor(s): Campbell Barton, M.G. Kishalmi
+#
+# ***** END GPL LICENSE BLOCK *****
+
+# <pep8 compliant>
+
+"""
+Example Win32 usage:
+ c:\Python32\python.exe c:\blender_dev\blender\build_files\cmake\cmake_qtcreator_project.py c:\blender_dev\cmake_build
+
+example linux usage
+ python .~/blenderSVN/blender/build_files/cmake/cmake_qtcreator_project.py ~/blenderSVN/cmake
+"""
+
+__all__ = (
+ "SIMPLE_PROJECTFILE",
+ "SOURCE_DIR",
+ "CMAKE_DIR",
+ "PROJECT_DIR",
+ "source_list",
+ "is_project_file",
+ "is_c_header",
+ "is_py",
+ "cmake_advanced_info",
+ "cmake_compiler_defines",
+)
+
+import sys
+import os
+from os.path import join, dirname, normpath, abspath, splitext, relpath, exists
+
+SOURCE_DIR = join(dirname(__file__), "..", "..")
+SOURCE_DIR = normpath(SOURCE_DIR)
+SOURCE_DIR = abspath(SOURCE_DIR)
+
+SIMPLE_PROJECTFILE = False
+
+# get cmake path
+CMAKE_DIR = sys.argv[-1]
+
+if not exists(join(CMAKE_DIR, "CMakeCache.txt")):
+ CMAKE_DIR = os.getcwd()
+if not exists(join(CMAKE_DIR, "CMakeCache.txt")):
+ print("CMakeCache.txt not found in %r or %r\n Pass CMake build dir as an argument, or run from that dir, aborting" % (CMAKE_DIR, os.getcwd()))
+ sys.exit(1)
+
+
+# could be either.
+# PROJECT_DIR = SOURCE_DIR
+PROJECT_DIR = CMAKE_DIR
+
+
+def source_list(path, filename_check=None):
+ for dirpath, dirnames, filenames in os.walk(path):
+
+ # skip '.svn'
+ if dirpath.startswith("."):
+ continue
+
+ for filename in filenames:
+ filepath = join(dirpath, filename)
+ if filename_check is None or filename_check(filepath):
+ yield filepath
+
+
+# extension checking
+def is_cmake(filename):
+ ext = splitext(filename)[1]
+ return (ext == ".cmake") or (filename.endswith("CMakeLists.txt"))
+
+
+def is_c_header(filename):
+ ext = splitext(filename)[1]
+ return (ext in (".h", ".hpp", ".hxx"))
+
+
+def is_py(filename):
+ ext = splitext(filename)[1]
+ return (ext == ".py")
+
+
+def is_glsl(filename):
+ ext = splitext(filename)[1]
+ return (ext == ".glsl")
+
+
+def is_c(filename):
+ ext = splitext(filename)[1]
+ return (ext in (".c", ".cpp", ".cxx", ".m", ".mm", ".rc"))
+
+
+def is_c_any(filename):
+ return is_c(filename) or is_c_header(filename)
+
+
+def is_svn_file(filename):
+ dn, fn = os.path.split(filename)
+ filename_svn = join(dn, ".svn", "text-base", "%s.svn-base" % fn)
+ return exists(filename_svn)
+
+
+def is_project_file(filename):
+ return (is_c_any(filename) or is_cmake(filename) or is_glsl(filename)) # and is_svn_file(filename)
+
+
+def cmake_advanced_info():
+ """ Extracr includes and defines from cmake.
+ """
+
+ def create_eclipse_project(CMAKE_DIR):
+ print("CMAKE_DIR %r" % CMAKE_DIR)
+ if sys.platform == "win32":
+ cmd = 'cmake "%s" -G"Eclipse CDT4 - MinGW Makefiles"' % CMAKE_DIR
+ else:
+ cmd = 'cmake "%s" -G"Eclipse CDT4 - Unix Makefiles"' % CMAKE_DIR
+
+ os.system(cmd)
+
+ includes = []
+ defines = []
+
+ create_eclipse_project(CMAKE_DIR)
+
+ from xml.dom.minidom import parse
+ tree = parse(join(CMAKE_DIR, ".cproject"))
+ '''
+ f = open(".cproject_pretty", 'w')
+ f.write(tree.toprettyxml(indent=" ", newl=""))
+ '''
+ ELEMENT_NODE = tree.ELEMENT_NODE
+
+ cproject, = tree.getElementsByTagName("cproject")
+ for storage in cproject.childNodes:
+ if storage.nodeType != ELEMENT_NODE:
+ continue
+
+ if storage.attributes["moduleId"].value == "org.eclipse.cdt.core.settings":
+ cconfig = storage.getElementsByTagName("cconfiguration")[0]
+ for substorage in cconfig.childNodes:
+ if substorage.nodeType != ELEMENT_NODE:
+ continue
+
+ moduleId = substorage.attributes["moduleId"].value
+
+ # org.eclipse.cdt.core.settings
+ # org.eclipse.cdt.core.language.mapping
+ # org.eclipse.cdt.core.externalSettings
+ # org.eclipse.cdt.core.pathentry
+ # org.eclipse.cdt.make.core.buildtargets
+
+ if moduleId == "org.eclipse.cdt.core.pathentry":
+ for path in substorage.childNodes:
+ if path.nodeType != ELEMENT_NODE:
+ continue
+ kind = path.attributes["kind"].value
+
+ if kind == "mac":
+ # <pathentry kind="mac" name="PREFIX" path="" value="&quot;/opt/blender25&quot;"/>
+ defines.append((path.attributes["name"].value, path.attributes["value"].value))
+ elif kind == "inc":
+ # <pathentry include="/data/src/blender/blender/source/blender/editors/include" kind="inc" path="" system="true"/>
+ includes.append(path.attributes["include"].value)
+ else:
+ pass
+
+ return includes, defines
+
+
+def cmake_cache_var(var):
+ cache_file = open(join(CMAKE_DIR, "CMakeCache.txt"))
+ lines = [l_strip for l in cache_file for l_strip in (l.strip(),) if l_strip if not l_strip.startswith("//") if not l_strip.startswith("#")]
+ cache_file.close()
+
+ for l in lines:
+ if l.split(":")[0] == var:
+ return l.split("=", 1)[-1]
+ return None
+
+
+def cmake_compiler_defines():
+ compiler = cmake_cache_var("CMAKE_C_COMPILER") # could do CXX too
+
+ if compiler is None:
+ print("Couldn't find the compiler, os defines will be omitted...")
+ return
+
+ import tempfile
+ temp_c = tempfile.mkstemp(suffix=".c")[1]
+ temp_def = tempfile.mkstemp(suffix=".def")[1]
+
+ os.system("%s -dM -E %s > %s" % (compiler, temp_c, temp_def))
+
+ temp_def_file = open(temp_def)
+ lines = [l.strip() for l in temp_def_file if l.strip()]
+ temp_def_file.close()
+
+ os.remove(temp_c)
+ os.remove(temp_def)
+ return lines