📄 pyste-environ.patch
字号:
diff -a -u -r1.1 -r1.2
--- CppParser.py 10 Jul 2004 23:32:00 -0000 1.1
+++ CppParser.py 11 Jul 2004 12:49:46 -0000 1.2
@@ -25,7 +25,7 @@
class CppParser:
'Parses a header file and returns a list of declarations'
- def __init__(self, includes=None, defines=None, cache_dir=None, version=None):
+ def __init__(self, includes=None, defines=None, cache_dir=None, version=None, gccxml_path = 'gccxml'):
'includes and defines ar the directives given to gcc'
if includes is None:
includes = []
@@ -34,6 +34,7 @@
self.includes = includes
self.defines = defines
self.version = version
+ self.gccxml_path = gccxml_path
#if cache_dir is None:
# cache_dir = tempfile.mktemp()
# self.delete_cache = True
@@ -111,10 +112,10 @@
includes = self._IncludeParams(filename)
defines = self._DefineParams()
# call gccxml
- cmd = 'gccxml %s %s "%s" -fxml=%s'
+ cmd = '%s %s %s "%s" -fxml=%s'
filename = self.Unixfy(filename)
xmlfile = self.Unixfy(xmlfile)
- status = os.system(cmd % (includes, defines, filename, xmlfile))
+ status = os.system(cmd % (self.gccxml_path, includes, defines, filename, xmlfile))
if status != 0 or not os.path.isfile(xmlfile):
raise CppParserError, 'Error executing gccxml'
# parse the resulting xml
--- pyste.py 10 Jul 2004 23:32:00 -0000 1.1
+++ pyste.py 11 Jul 2004 12:49:46 -0000 1.2
@@ -31,6 +31,8 @@
--file-list A file with one pyste file per line. Use as a
substitute for passing the files in the command
line.
+ --gccxml-path=<path> Path to gccxml executable (default: gccxml)
+ --no-default-include Do not use INCLUDE environment variable fpr default
-h, --help Print this help and exit
-v, --version Print version information
"""
@@ -104,13 +106,15 @@
sys.argv[1:],
'R:I:D:vh',
['module=', 'multiple', 'out=', 'no-using', 'pyste-ns=', 'debug', 'cache-dir=',
- 'only-create-cache', 'version', 'generate-main', 'file-list=', 'help'])
+ 'only-create-cache', 'version', 'generate-main', 'file-list=', 'help', 'gccxml-path=',
+ 'no-default-include'])
except getopt.GetoptError, e:
print
print 'ERROR:', e
Usage()
-
- includes = GetDefaultIncludes()
+
+ default_includes = GetDefaultIncludes()
+ includes = []
defines = []
module = None
out = None
@@ -118,6 +122,7 @@
cache_dir = None
create_cache = False
generate_main = False
+ gccxml_path = 'gccxml'
for opt, value in options:
if opt == '-I':
@@ -152,10 +157,16 @@
sys.exit(2)
elif opt == '--generate-main':
generate_main = True
+ elif opt == '--gccxml-path':
+ gccxml_path = value
+ elif opt == '--no-default-include':
+ default_includes = []
else:
print 'Unknown option:', opt
Usage()
+ includes[0:0] = default_includes
+
if not files:
Usage()
if not module:
@@ -180,7 +191,7 @@
sys.exit(3)
ProcessIncludes(includes)
- return includes, defines, module, out, files, multiple, cache_dir, create_cache, generate_main
+ return includes, defines, module, out, files, multiple, cache_dir, create_cache, generate_main, gccxml_path
def PCHInclude(*headers):
@@ -233,12 +244,12 @@
def Begin():
# parse arguments
- includes, defines, module, out, interfaces, multiple, cache_dir, create_cache, generate_main = ParseArguments()
+ includes, defines, module, out, interfaces, multiple, cache_dir, create_cache, generate_main, gccxml_path = ParseArguments()
# run pyste scripts
for interface in interfaces:
ExecuteInterface(interface)
# create the parser
- parser = CppParser(includes, defines, cache_dir, declarations.version)
+ parser = CppParser(includes, defines, cache_dir, declarations.version, gccxml_path)
try:
if not create_cache:
if not generate_main:
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -