Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import re
- import os
- def _unidiff_output(expected, actual):
- """
- Helper function. Returns a string containing the unified diff of two multiline strings.
- """
- import difflib
- expected=expected.splitlines(1)
- actual=actual.splitlines(1)
- diff=difflib.unified_diff(expected, actual)
- return ''.join(diff)
- def return_nix_libraries_list(nix_file_path):
- original_content = ""
- with open(nix_file_path,'r') as nix_file:
- nix_file_content = nix_file.read()
- #print(nix_file_content)
- derivations_list = re.findall(re.compile('\s+pname = "(.*?)";\s+version = "(.*?)";\s+sha256 = "(.*?)";(\s+revision = "(.*?)";)*', re.MULTILINE), nix_file_content)
- for derivation in derivations_list:
- pname = derivation[0]
- version = derivation[1]
- sha256 = derivation[2]
- revision = derivation[4]
- original_content += pname + ', ' + version + ', ' + sha256 + ', ' + revision + os.linesep
- #print(pname + ', ' + version + ', ' + sha256 + ', ' + revision)
- return original_content
- # _unidiff_output(return_nix_libraries_list('path_to_default.nix'), return_nix_libraries_list('path_to_default.nix'))
Add Comment
Please, Sign In to add comment