rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
pkgmap.GetPkgmapLineByBasename("foo")
def testGetLinesBySoname_8(self): expected = {'foo.so.1': '/opt/csw/postgresql/lib/foo.so.1 foo'} pkgmap = self.pkgmap_mocker.CreateMock(checkpkg.SystemPkgmap) pkgmap.GetPkgmapLineByBasename("foo") lines1 = {"/opt/csw/lib/postgresql": "/opt/csw/lib/postgresql/foo.so.1 foo"} pkgmap.GetPkgmapLineByBasename("foo.so.1").An...
}
},
# def CheckSomething(pkg_data, error_mgr, logger, messenger):
self.pkg_data = neon_stats[0]
self.pkg_data = copy.deepcopy(neon_stats[0])
def CheckpkgTest(self): self.pkg_data = neon_stats[0] self.pkg_data["pkgmap"].append({ "class": "none", "type": "f", "line": "", "user": "root", "group": "bin", "mode": '0755', "path": "/opt/csw/share/doc/alien/license", }) self.error_mgr_mock.ReportError( 'wrong-docdir', 'expected=/opt/csw/shared/doc/neon/... ' 'in-pa...
self.pkg_data = neon_stats[0]
self.pkg_data = copy.deepcopy(neon_stats[0])
def CheckpkgTest(self): self.pkg_data = neon_stats[0] self.pkg_data["pkgmap"].append({ "class": "none", "type": "f", "line": "", "user": "root", "group": "bin", "mode": '0755', "path": "/opt/csw/share/doc/alien/random_file", })
for package_stats_obj in stats_obj_list: pkg_data = package_stats_obj.GetAllStats()
for pkg_data in pkgs_data:
def GetAllTags(self, stats_obj_list): errors = {} # TODO: Actually configure the logger with the logging level. logging_level = logging.INFO if self.debug: logging_level = logging.DEBUG pkgmap = SystemPkgmap()
pkgs_data = [x.GetAllStats() for x in stats_obj_list]
def GetAllTags(self, stats_obj_list): errors = {} # TODO: Actually configure the logger with the logging level. logging_level = logging.INFO if self.debug: logging_level = logging.DEBUG pkgmap = SystemPkgmap()
overrides = [Override(**x) for x in override_stats] return overrides
override_list = [overrides.Override(**x) for x in override_stats] return override_list
def GetSavedOverrides(self): if not self.StatsExist(): raise PackageError("Package stats not ready.") override_stats = self.ReadObject("overrides") overrides = [Override(**x) for x in override_stats] return overrides
if needed_sonames:
if options.debug and needed_sonames:
def main(): result_ok = True errors = [] options, args = checkpkg.GetOptions() pkgnames = args if options.debug: logging.basicConfig(level=logging.DEBUG) else: logging.basicConfig(level=logging.INFO) checkers = [] for pkgname in pkgnames: checker = checkpkg.CheckpkgBase(options.extractdir, pkgname) checkers.append(chec...
runpath_list = binary_info["runpath"] + checkpkg.SYS_DEFAULT_RUNPATH
runpath_list = binary_info["runpath"] + tuple(checkpkg.SYS_DEFAULT_RUNPATH)
def Libraries(pkg_data, error_mgr, logger, path_and_pkg_by_soname): pkgname = pkg_data["basic_stats"]["pkgname"] logger.debug("Libraries(): pkgname = %s", repr(pkgname)) orphan_sonames = [] required_deps = [] isalist = pkg_data["isalist"] ldd_emulator = checkpkg.LddEmulator() for binary_info in pkg_data["binaries_dump_...
"named %s, but the package name is %s.
"named %s, but the package name is %s. "
def CheckSharedLibraryNamingPolicy(pkg_data, error_mgr, logger, messenger): pkgname = pkg_data["basic_stats"]["pkgname"] shared_libs = set(su.GetSharedLibs(pkg_data)) linkable_shared_libs = [] for binary_info in pkg_data["binaries_dump_info"]: if binary_info["path"] in shared_libs: if su.IsLibraryLinkable(binary_info["...
"More information: " "http://wiki.opencsw.org/checkpkg-error-tags"
def CheckSharedLibraryNamingPolicy(pkg_data, error_mgr, logger, messenger): pkgname = pkg_data["basic_stats"]["pkgname"] shared_libs = set(su.GetSharedLibs(pkg_data)) linkable_shared_libs = [] for binary_info in pkg_data["binaries_dump_info"]: if binary_info["path"] in shared_libs: if su.IsLibraryLinkable(binary_info["...
release_mgr_name=config.get(CONFIG_RELEASE_SECTION, "release manager name"),
release_mgr_name = config.get(CONFIG_RELEASE_SECTION, "release manager name")
def main(): try: config = ConfigParser.SafeConfigParser() for file_name_tmpl in CONFIGURATION_FILE_LOCATIONS: config.read(file_name_tmpl % os.environ) for opt_name in CONFIG_REQUIRED_OPTS: if not config.has_option(CONFIG_RELEASE_SECTION, opt_name): logging.error("Option %s is missing from the configuration.", repr(opt_...
self.debug("Creating the config table.")
logging.debug("Creating the config table.")
def __init__(self): """There is no need to re-parse it each time.
md5_re = re.compile(r"[0123456789abcdef]{32}")
md5_re = re.compile(r"^[0123456789abcdef]{32}$")
def main(): usage = "Usage: %prog [ options ] file | md5 [ file | md5 [ ... ] ]" parser = optparse.OptionParser(usage) parser.add_option("-d", "--debug", dest="debug", default=False, action="store_true", help="Turn on debugging messages") parser.add_option("-p", "--print_stats", dest="print_stats", default=False, actio...
pkgstat_objs.append(checkpkg.PackageStats(x, debug=options.debug))
pkgstat_objs.append(checkpkg.PackageStats(pkg, debug=options.debug))
def main(): usage = "Usage: %prog [ options ] file | md5 [ file | md5 [ ... ] ]" parser = optparse.OptionParser(usage) parser.add_option("-d", "--debug", dest="debug", default=False, action="store_true", help="Turn on debugging messages") parser.add_option("-p", "--print_stats", dest="print_stats", default=False, actio...
pprint.pprint(pkgstat_objs)
pprint.pprint(pkgstats)
def main(): usage = "Usage: %prog [ options ] file | md5 [ file | md5 [ ... ] ]" parser = optparse.OptionParser(usage) parser.add_option("-d", "--debug", dest="debug", default=False, action="store_true", help="Turn on debugging messages") parser.add_option("-p", "--print_stats", dest="print_stats", default=False, actio...
"any package: %s" % checker.soname))
"any package: %s" % soname))
def main(): result_ok = True errors = [] options, args = checkpkg.GetOptions() pkgnames = args if options.debug: logging.basicConfig(level=logging.DEBUG) else: logging.basicConfig(level=logging.INFO) checkers = [] for pkgname in pkgnames: checker = checkpkg.CheckpkgBase(options.extractdir, pkgname) checkers.append(chec...
>>>>>>> mGAR v2: patchpkg, new function to compose package names.
def ToSrv4(self, dest_dir): self.Transform() pkginfo = self.dir_pkg.GetParsedPkginfo() # version = pkginfo["VERSION"] date_str = datetime.datetime.now().strftime("%Y-%m-%d") self.parsed_filename["revision_info"]["REV"] = date_str new_filename = opencsw.ComposePackageFileName(self.parsed_filename) pprint.pprint(self.par...
logging.info("transforming: %s", args)
logging.debug("transforming: %s", args)
def TransformToDir(self): """Transforms the file to the directory format.
config = app.upload_set_config.get(setname)
config = current_app.upload_set_config.get(setname)
def uploaded_file(setname, filename): config = app.upload_set_config.get(setname) if config is None: abort(404) send_from_directory(config.destination, filename)
send_from_directory(config.destination, filename)
return send_from_directory(config.destination, filename)
def uploaded_file(setname, filename): config = app.upload_set_config.get(setname) if config is None: abort(404) send_from_directory(config.destination, filename)
def get_all(self):
def get_all(self, **kw):
def get_all(self): r = [] for sub in self.data: ok = True for k, v in kw: if k == "tag": if not isinstance(sub, TagNode): ok = False elif not sub.name == v: ok = False elif k == "att": if not isinstance(sub, AttributeNode): ok = False elif not sub.name == v: ok = False if ok: r.append(sub) return r
pattern = re.compile(os.sep + pattern + "$")
pattern = re.compile(pattern)
def mark_matching_resources(self, pattern, fn, n): "Mark all definitions matching a specified pattern with a reference." pattern = pattern.replace("+", r"\+") try: pattern = re.compile(os.sep + pattern + "$") except sre_constants.error: print >>sys.stderr, "wmlscope: confused by %s" % pattern return None key = None for...
output = tempfile.NamedTemporaryFile(prefix = "wmlparser_", suffix = ".cfg").name if not os.path.exists(output): os.mkdir(output)
output = tempfile.mkdtemp(prefix="wmlparser_")
def preprocess(self, defines): """ Call wesnoth --preprocess to get preprocessed WML which we can subsequently parse. If this is not called then the .parse method will assume the WML is already preprocessed. """ output = tempfile.NamedTemporaryFile(prefix = "wmlparser_", suffix = ".cfg").name if not os.path.exists(out...
sub = put_file(os.path.basename(fn), file(fn))
sub = put_file(os.path.basename(fn), open(fn, 'rb'))
def put_dir(name, path): for ig in ign: if ig[-1] == "/" and fnmatch.fnmatch(name, ig[:-1]): print("Ignored dir", name) return None dataNode = wmldata.DataSub("dir") dataNode.set_text_val("name", name) for fn in glob.glob(path + "/*"): if os.path.isdir(fn): sub = put_dir(os.path.basename(fn), fn) else: sub = put_file(o...
sys.stderr.write("Empty table:\n" + data + "\n")
sys.stderr.write("Empty table:\n%s\n" % data)
def is_empty_table(res, data): """ This checks whether or not a table is empty and writes to stderr if it is. It returns True if the table is empty, False otherwise. """ if not res: sys.stderr.write("Empty table:\n" + data + "\n") return True return False
sys.stderr.write("data : " + data)
sys.stderr.write("data : %s" % data)
def debug_dump(data, res): """Show the data the regex retrieved from a match.
result += "| " + i[0] + "\n" result += "| [[GUIVariable
result += "| %s\n" % i[0] result += "| [[GUIVariable
def create_config_table(data): """Creates a table for data in a config table.
result += "| " + i[2] + "\n" result += "| " + format(i[3]) + "\n"
result += "| %s\n" % i[2] result += "| %s\n" % format(i[3])
def create_config_table(data): """Creates a table for data in a config table.
result += "| " + i[0] + "\n" result += "| " + i[1] + "\n" result += "| " + format(i[2]) + "\n"
result += "| %s\n" % i[0] result += "| %s\n" % i[1] result += "| %s\n" % format(i[2])
def create_formula_table(data): """Creates a table for data in a formula table.
result += '| <span id="' + i[0] + '">' + i[0] + '</span>\n' result += "| " + format(i[1]) + "\n"
result += '| <span id="%s">%s</span>\n' % (i[0], i[0]) result += "| %s\n" % format(i[1])
def create_variable_types_table(data): """Creates a table for the variable types."""
result += "| " + '<span id="' + i[0].lower() + "\">"
result += '| <span id="%s">' % i[0].lower()
def create_widget_overview_table(data): """Creates a table for all available widgets.""" #matches a line like # Button & A push button. $ regex = re.compile("([A-Za-z]\w*) +& +(.*) +\$") res = regex.findall(data)
result += " ([[GUIWidgetDefinitionWML result += i[0] result += "|definition]]" result += ", [[GUIWidgetInstanceWML result += i[0] result += "|instantiation]])\n" result += "| " + format(i[1]) + "\n"
result += " ([[GUIWidgetDefinitionWML result += ", [[GUIWidgetInstanceWML result += "| %s\n" % format(i[1])
def create_widget_overview_table(data): """Creates a table for all available widgets.""" #matches a line like # Button & A push button. $ regex = re.compile("([A-Za-z]\w*) +& +(.*) +\$") res = regex.findall(data)
result += " ([[GUIWindowDefinitionWML result += i[0] result += "|definition]])\n" result += "| " + format(i[1]) + "\n" result += "|}" return result def create_container_table(data): """Creates a table for a container.""" print "The container table is deprecated, use the grid instead.\n" variable ...
result += " ([[GUIWindowDefinitionWML result += "| %s\n" % format(i[1])
def create_window_overview_table(data): """Creates a table for all available windows.""" #matches a line like # Addon_connect & The dialog to connect to the addon server $ regex = re.compile("([A-Za-z]\w*) +& +(.*) +\$") res = regex.findall(data)
result += " (" + i[2] + ")\n" result += "| " + "[[GUIToolkitWML if i[4] == "m":
result += " (%s)\n" % i[2] result += "| [[GUIToolkitWML if i[4] == 'm':
def create_dialog_widgets_table(data): """Creates a table for the widgets in a dialog."""
result += "| " + format(i[5]) + "\n"
result += "| %s\n" % format(i[5])
def create_dialog_widgets_table(data): """Creates a table for the widgets in a dialog."""
"container": create_container_table,
def create_table(table): """Wrapper for creating tables."""
if header[0] == None:
if not header[0]:
def process(data): """Processes a wiki block."""
with open(output_directory + file, "w") as fd:
with open(os.path.join(output_directory, file), "w") as fd:
def create_output(): """Generates the output"""
if os.path.isdir(dir + "/" + item): process_directory(dir + "/" + item)
if os.path.isdir(os.path.join(dir, item)): process_directory(os.path.join(dir, item))
def process_directory(dir): """Processes a directory.
process_file(dir + "/" + item)
process_file(os.path.join(dir, item))
def process_directory(dir): """Processes a directory.
if os.path.isdir(dir + "/" + item): process_directory_macros(dir + "/" + item)
if os.path.isdir(os.path.join(dir, item)): process_directory_macros(os.path.join(dir, item))
def process_directory_macros(dir): """Processes a directory looking for macros.
process_file_macros(dir + "/" + item)
process_file_macros(os.path.join(dir, item))
def process_directory_macros(dir): """Processes a directory looking for macros.
class Node:
class Node(object):
def get_datatype(self, name): return self.datatypes[name]
self.elements = []
self.elements = set([])
def __init__(self, schema, datatypes): self.name = schema.name self.elements = [] self.ext_elements = [] #Ugh, do we really want to do this? self.attributes = [] self.parent = None for item in schema.get_all_text(): if item.name[0] == '_': self.elements.append( Element(item) ) else: self.attributes.append( Attribute(it...
self.attributes = []
self.attributes = set([])
def __init__(self, schema, datatypes): self.name = schema.name self.elements = [] self.ext_elements = [] #Ugh, do we really want to do this? self.attributes = [] self.parent = None for item in schema.get_all_text(): if item.name[0] == '_': self.elements.append( Element(item) ) else: self.attributes.append( Attribute(it...
self.elements.append( Element(item) )
self.elements.add( Element(item) )
def __init__(self, schema, datatypes): self.name = schema.name self.elements = [] self.ext_elements = [] #Ugh, do we really want to do this? self.attributes = [] self.parent = None for item in schema.get_all_text(): if item.name[0] == '_': self.elements.append( Element(item) ) else: self.attributes.append( Attribute(it...
self.attributes.append( Attribute(item, datatypes) )
self.attributes.add( Attribute(item, datatypes) )
def __init__(self, schema, datatypes): self.name = schema.name self.elements = [] self.ext_elements = [] #Ugh, do we really want to do this? self.attributes = [] self.parent = None for item in schema.get_all_text(): if item.name[0] == '_': self.elements.append( Element(item) ) else: self.attributes.append( Attribute(it...
print "[element] found, not parsing yet"
print "[element] found in schema, not parsing yet"
def __init__(self, schema, datatypes): self.name = schema.name self.elements = [] self.ext_elements = [] #Ugh, do we really want to do this? self.attributes = [] self.parent = None for item in schema.get_all_text(): if item.name[0] == '_': self.elements.append( Element(item) ) else: self.attributes.append( Attribute(it...
self.elements += other.elements self.attributes += other.attributes
self.elements.update( other.elements ) self.attributes.update( other.attributes )
def inherit(self, other): assert self.parent == other.name self.elements += other.elements self.attributes += other.attributes self.parent = None
class Element:
class Element(object):
def get_elements(self): return self.elements
class Attribute:
class Attribute(object):
def match(self, name): return bool(self.re.match(name))
def jsonify(tree, verbose=False):
def jsonify(tree, verbose=False, depth=0):
def jsonify(tree, verbose=False): """
if verbose: print
def jsonify(tree, verbose=False): """
print ",", if verbose: print print '"%s":' % child.name,
sys.stdout.write(",") if verbose: sys.stdout.write(sdepth2) print'"%s":' % child.name,
def jsonify(tree, verbose=False): """
jsonify(child)
jsonify(child, verbose, depth + 1)
def jsonify(tree, verbose=False): """
if verbose: print print "}", if verbose: print
if verbose: sys.stdout.write(sdepth1) sys.stdout.write("}")
def jsonify(tree, verbose=False): """
jsonify(data)
jsonify(data, True)
def gt(domain, x): print "gettext: '%s' '%s'" % (domain, x) return x
print e
try: print(e) except UnicodeEncodeError: print(e.text.encode("utf8", "ignore"))
def add_addons(self, image_collector): """ Find all addon eras and campaigns. """ n = 0 try: WML = self.parser.parse(""" #define MULTIPLAYER\n#enddef #define RANDOM_SIDE\n#enddef {~add-ons} """) except wmlparser.Error, e: print e return n for campaign in WML.find_all("campaign"): cid = self.add_campaign(campaign)
def reindent( data):
def is_empty_table(res, data): """ This checks that a table is not empty and writes to stderr if it is. It returns True if the table is empty, False otherwise. """ if not res: sys.stderr.write("Empty table:\n" + data + "\n") return True return False def reindent(data):
def reindent( data): """Converts the raw input to an easier to use format. Lines starting with 8 spaces are concatenated with the previous line. The start of line ' *' are removed and if another space exists it's also removed."""
key1 = "^" + key sep = "(?: )*=(?: )" value = "(.*)$"
def get_value(data, key): """Extracts data from a key value pair, a key must start at the start of a line."""
if(res != None):
if res != None:
def get_value(data, key): """Extracts data from a key value pair, a key must start at the start of a line."""
if(order == None):
if order == None:
def process_header(data): """Processes the header."""
if(len(res) == 0): sys.stderr.write("Empty table:\n" + data + "\n")
if is_empty_table(res, data):
def create_config_table(data): """Creates a table for data in a config table.
if(res[i][2] == ""):
if not res[i][2]:
def create_config_table(data): """Creates a table for data in a config table.
if(len(res) == 0): sys.stderr.write("Empty table:\n" + data + "\n")
if is_empty_table(res, data):
def create_formula_table(data): """Creates a table for data in a formula table.
if(len(res) == 0): sys.stderr.write("Empty table:\n" + data + "\n")
if is_empty_table(res, data):
def create_variable_types_table(data): """Creates a table for the variable types."""
result += "| <span id=\"" + res[i][0] + "\">" + res[i][0] + "</span>\n"
result += '| <span id="' + res[i][0] + '">' + res[i][0] + '</span>\n'
def create_variable_types_table(data): """Creates a table for the variable types."""
if(len(res) == 0): sys.stderr.write("Empty table:\n" + data + "\n")
if is_empty_table(res, data):
def create_widget_overview_table(data): """Creates a table for all available widgets.""" #matches a line like # Button A push button. variable = "(?:[a-z]|[A-Z])(?:[a-z]|[A-Z]|[0-9]|_)*" regex = re.compile(" *(" + variable + ") +(.*)\n") res = regex.findall(data)
result += "| " + "<span id=\"" + res[i][0].lower() + "\">"
result += "| " + '<span id="' + res[i][0].lower() + "\">"
def create_widget_overview_table(data): """Creates a table for all available widgets.""" #matches a line like # Button A push button. variable = "(?:[a-z]|[A-Z])(?:[a-z]|[A-Z]|[0-9]|_)*" regex = re.compile(" *(" + variable + ") +(.*)\n") res = regex.findall(data)
if(len(res) == 0): sys.stderr.write("Empty table:\n" + data + "\n")
if is_empty_table(res, data):
def create_window_overview_table(data): """Creates a table for all available windows.""" #matches a line like # Addon_connect The dialog to connect to the addon server variable = "(?:[a-z]|[A-Z])(?:[a-z]|[A-Z]|[0-9]|_)*" regex = re.compile(" *(" + variable + ") +(.*)\n") res = regex.findall(data)
if(len(res) == 0): sys.stderr.write("Empty table:\n" + data + "\n")
if is_empty_table(res, data):
def create_container_table(data): """Creates a table for a container.""" print "The container table is deprecated, use the grid instead.\n"
if(res[i][1] == ""):
if not res[i][1]:
def create_container_table(data): """Creates a table for a container.""" print "The container table is deprecated, use the grid instead.\n"
if(res[i][3] == ""):
if not res[i][3]:
def create_container_table(data): """Creates a table for a container.""" print "The container table is deprecated, use the grid instead.\n"
if(res[i][0] == ""):
if not res[i][0]:
def create_container_table(data): """Creates a table for a container.""" print "The container table is deprecated, use the grid instead.\n"
regex = "" regex += " *(-*)" regex += "((?:[a-z]|[A-Z]|[0-9]|_)+ |) *&" regex += " *(.*) +&" regex += " *(.*?) +&" regex += " *(m|o) +&" regex += " *(.*) +\$" res = re.compile(regex).findall(data) if(len(res) == 0): sys.stderr.write("Empty table:\n" + data + "\n") return "Empty table." result = "" result += '{| bo...
regex = """ \ *(-*) ((?:[a-z]|[A-Z]|[0-9]|_)+\ |)\ *& \ *(.*)\ +& \ *(.*?)\ +& \ *(m|o)\ +& \ *(.*)\ +\$ """ res = re.compile(regex, re.VERBOSE).findall(data) if is_empty_table(res, data): return "Empty table." result = '{| border="1"'
def create_dialog_widgets_table(data) : """Creates a table for the widgets in a dialog."""
if(res[i][1] == ""): result += "''free to choose''"
if not res[i][1]: result += "''free to choose''"
def create_dialog_widgets_table(data) : """Creates a table for the widgets in a dialog."""
if(res[i][2] == ""):
if not res[i][2]:
def create_dialog_widgets_table(data) : """Creates a table for the widgets in a dialog."""
if(res[i][4] == "m"):
if res[i][4] == "m":
def create_dialog_widgets_table(data) : """Creates a table for the widgets in a dialog."""
res = re.compile("(.*?)\n\n(.*)", re.S).findall(data); if(res != None and len(res) != 0):
res = re.compile("(.*?)\n\n(.*)", re.S).findall(data) if res:
def process(data): """Processes a wiki block."""
if(header[0] == None): print "File: " + current_file print "Block:\n" + current_block
if header[0] == None: print "File: " + current_file print "Block:\n" + current_block
def process(data): """Processes a wiki block."""
if(file_map.has_key(header[0]) == False):
if not file_map.has_key(header[0]):
def process(data): """Processes a wiki block."""
if(res != None):
if res:
def process_file(name): """Processes all wiki blocks (if any) of a file."""
if(item.startswith(".")):
if item.startswith("."):
def process_directory(dir): """Processes a directory.
if(os.path.isdir(dir + "/" + item)):
if os.path.isdir(dir + "/" + item):
def process_directory(dir): """Processes a directory.
elif(item.endswith(".cpp") or item.endswith(".hpp")):
elif item.endswith(".cpp") or item.endswith(".hpp"):
def process_directory(dir): """Processes a directory.
if(macro_map.has_key(macro.group(1)) == False): print "Macro '" + macro.group(1) + "' is not defined."
if not macro_map.has_key(macro.group(1)): print "Macro '%s' is not defined." % macro.group(1)
def instanciate_macro(macro): """Replaces a macro text by the marco value."""
if(macro_map.has_key(macro.group(1))): print "Macro '" + macro.group(1) + "' is being redefined."
if macro_map.has_key(macro.group(1)): print "Macro '%s' is being redefined." % macro.group(1)
def create_macro(macro): """Wrapper for creating macros."""
if(res != None):
if res:
def process_file_macros(name): """Processes all wiki macro blocks (if any) of a file."""
items = os.listdir(dir) for item in items:
for item in os.listdir(dir):
def process_directory_macros(dir): """Processes a directory looking for macros.
if(item.startswith(".")):
if item.startswith("."):
def process_directory_macros(dir): """Processes a directory looking for macros.
if(os.path.isdir(dir + "/" + item)):
if os.path.isdir(dir + "/" + item):
def process_directory_macros(dir): """Processes a directory looking for macros.
elif(item.endswith(".cpp") or item.endswith(".hpp")):
elif item.endswith(".cpp") or item.endswith(".hpp"):
def process_directory_macros(dir): """Processes a directory looking for macros.
self.file = tempfile.NamedTemporaryFile(prefix = "wmlparser_",
temp = tempfile.NamedTemporaryFile(prefix = "wmlparser_",
def parse_text(self, text, defines = ""): self.file = tempfile.NamedTemporaryFile(prefix = "wmlparser_", suffix = ".cfg") self.file.write(text) self.file.flush() self.path = self.file.name self.preprocess(defines) self.parse()
self.file.write(text) self.file.flush() self.path = self.file.name
temp.write(text) temp.flush() self.path = temp.name
def parse_text(self, text, defines = ""): self.file = tempfile.NamedTemporaryFile(prefix = "wmlparser_", suffix = ".cfg") self.file.write(text) self.file.flush() self.path = self.file.name self.preprocess(defines) self.parse()
output = "/tmp/wmlparser"
output = tempfile.NamedTemporaryFile(prefix = "wmlparser_", suffix = ".cfg").name
def preprocess(self, defines): """ Call wesnoth --preprocess to get preprocessed WML which we can subsequently parse. If this is not called then the .parse method will assume the WML is already preprocessed. """ output = "/tmp/wmlparser" if not os.path.exists(output): os.mkdir(output) p_option = "-p=" + defines if def...
after = before
def process_file(path): before = open(path, "r").read() after = before decommented = re.sub("#.*", "", before) for (domain, fixes) in stringfixes.items(): # In case of screwed-up pairs that are hard to find, uncomment the following: #for fix in fixes: # if len(fix) != 2: # print fix for (old, new) in fixes: i...
lines = after.split('\n')
def process_file(path): before = open(path, "r").read() after = before decommented = re.sub("#.*", "", before) for (domain, fixes) in stringfixes.items(): # In case of screwed-up pairs that are hard to find, uncomment the following: #for fix in fixes: # if len(fix) != 2: # print fix for (old, new) in fixes: i...
com = "mv " + f + "/" + name + " " + t + "/"
def move(f, t, name): com = "mv " + f + "/" + name + " " + t + "/" if os.path.exists(f + "/" + name + ".cfg"): com = "mv " + f + "/" + name + ".cfg " + t + "/" shell(com)
com = "mv " + f + "/" + name + ".cfg " + t + "/"
com = "mv " + f + "/" + bash(name + ".cfg") + " " + t + "/" shell(com) com = "mv " + f + "/" + bash(name) + " " + t + "/"
def move(f, t, name): com = "mv " + f + "/" + name + " " + t + "/" if os.path.exists(f + "/" + name + ".cfg"): com = "mv " + f + "/" + name + ".cfg " + t + "/" shell(com)