Lines 340-346
def stack_lists(lists, incremental=1, remember_source_file=False,
Link Here
|
340 |
else: |
340 |
else: |
341 |
return list(new_list) |
341 |
return list(new_list) |
342 |
|
342 |
|
343 |
def grabdict(myfilename, juststrings=0, empty=0, recursive=0, incremental=1): |
343 |
def grabdict(myfilename, juststrings=0, empty=0, recursive=0, incremental=1, newlines=0): |
344 |
""" |
344 |
""" |
345 |
This function grabs the lines in a file, normalizes whitespace and returns lines in a dictionary |
345 |
This function grabs the lines in a file, normalizes whitespace and returns lines in a dictionary |
346 |
|
346 |
|
Lines 354-359
def grabdict(myfilename, juststrings=0, empty=0, recursive=0, incremental=1):
Link Here
|
354 |
@type recursive: Boolean (integer) |
354 |
@type recursive: Boolean (integer) |
355 |
@param incremental: Append to the return list, don't overwrite |
355 |
@param incremental: Append to the return list, don't overwrite |
356 |
@type incremental: Boolean (integer) |
356 |
@type incremental: Boolean (integer) |
|
|
357 |
@param newlines: Append newlines |
358 |
@type newlines: Boolean (integer) |
357 |
@rtype: Dictionary |
359 |
@rtype: Dictionary |
358 |
@return: |
360 |
@return: |
359 |
1. Returns the lines in a file in a dictionary, for example: |
361 |
1. Returns the lines in a file in a dictionary, for example: |
Lines 379-384
def grabdict(myfilename, juststrings=0, empty=0, recursive=0, incremental=1):
Link Here
|
379 |
continue |
381 |
continue |
380 |
if len(myline) < 1 and empty == 1: |
382 |
if len(myline) < 1 and empty == 1: |
381 |
continue |
383 |
continue |
|
|
384 |
if newlines: |
385 |
myline.append("\n") |
382 |
if incremental: |
386 |
if incremental: |
383 |
newdict.setdefault(myline[0], []).extend(myline[1:]) |
387 |
newdict.setdefault(myline[0], []).extend(myline[1:]) |
384 |
else: |
388 |
else: |
Lines 424-430
def read_corresponding_eapi_file(filename, default="0"):
Link Here
|
424 |
return default |
428 |
return default |
425 |
return eapi |
429 |
return eapi |
426 |
|
430 |
|
427 |
def grabdict_package(myfilename, juststrings=0, recursive=0, |
431 |
def grabdict_package(myfilename, juststrings=0, recursive=0, newlines=0, |
428 |
allow_wildcard=False, allow_repo=False, allow_build_id=False, |
432 |
allow_wildcard=False, allow_repo=False, allow_build_id=False, |
429 |
verify_eapi=False, eapi=None, eapi_default="0"): |
433 |
verify_eapi=False, eapi=None, eapi_default="0"): |
430 |
""" Does the same thing as grabdict except it validates keys |
434 |
""" Does the same thing as grabdict except it validates keys |
Lines 438-444
def grabdict_package(myfilename, juststrings=0, recursive=0,
Link Here
|
438 |
atoms = {} |
442 |
atoms = {} |
439 |
for filename in file_list: |
443 |
for filename in file_list: |
440 |
d = grabdict(filename, juststrings=False, |
444 |
d = grabdict(filename, juststrings=False, |
441 |
empty=True, recursive=False, incremental=True) |
445 |
empty=True, recursive=False, incremental=True, newlines=newlines) |
442 |
if not d: |
446 |
if not d: |
443 |
continue |
447 |
continue |
444 |
if verify_eapi and eapi is None: |
448 |
if verify_eapi and eapi is None: |
445 |
- |
|
|