Last active
March 13, 2022 08:44
-
-
Save ychevarrias/fe384900b61a30a06e50ed2c70f665f2 to your computer and use it in GitHub Desktop.
Revisions
-
ychevarrias revised this gist
Mar 13, 2022 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,6 @@ import subprocess result = subprocess.run(['pip', 'freeze'], stdout=subprocess.PIPE) rq_file = open("requirements.txt", "r") rq_file_versioned = open("requirements_versioned.txt", "w") rq_versioned = list() versioned_lines = result.stdout.decode("utf-8").split("\n")[:-1] -
ychevarrias revised this gist
Mar 13, 2022 . 1 changed file with 5 additions and 6 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,12 +1,11 @@ import subprocess result = subprocess.run(['pip', 'freeze'], stdout=subprocess.PIPE) rq_file = open("requirements.txt.bk", "r") rq_file_versioned = open("requirements_versioned.txt", "w") rq_versioned = list() versioned_lines = result.stdout.decode("utf-8").split("\n")[:-1] rq_lines = rq_file.readlines() rq_file.close() def match(dependency): global versioned_lines @@ -26,4 +25,4 @@ def match(dependency): rq_versioned.append(match(dependency)) rq_file_versioned.write("\n".join(rq_versioned)) rq_file_versioned.close() -
ychevarrias revised this gist
Mar 12, 2022 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -4,9 +4,9 @@ rq_versioned = list() versioned_lines = rq_file_bulk.readlines() rq_lines = rq_file.readlines() rq_file.close() rq_file_bulk.close() def match(dependency): global versioned_lines -
ychevarrias revised this gist
Mar 12, 2022 . 1 changed file with 16 additions and 11 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,24 +1,29 @@ rq_file = open("requirements.txt", "r") rq_file_bulk = open("requirements_bulk.txt", "r") rq_file_versioned = open("requirements_versioned.txt", "w") rq_versioned = list() versioned_lines = rq_file_bulk.readlines() rq_file_bulk.close() rq_lines = rq_file.readlines() rq_file.close() def match(dependency): global versioned_lines for versioned_line in versioned_lines: versioned_line = versioned_line.strip() dependency_bulk = versioned_line.split("==")[0] if dependency == dependency_bulk: print(f"FOUND : {dependency} => {versioned_line}") return versioned_line print(f"SKIP : {dependency}") return dependency for rq_line in rq_lines: rq_line = rq_line.strip() dependency = rq_line.split("==")[0] rq_versioned.append(match(dependency)) rq_file_versioned.write("\n".join(rq_versioned)) rq_file_versioned.close() -
ychevarrias created this gist
Mar 12, 2022 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,24 @@ rq_file = open("requirements.txt", "r") rq_file_bulk = open("requirements_bulk.txt", "r") rq_file_versioned = open("requirements_fixed.txt", "w") rq_versioned = list() versioned_lines = rq_file_bulk.readlines() rq_file_bulk.close() rq_lines = rq_file.readlines() rq_file.close() for rq_line in rq_lines: rq_line = rq_line.strip() line_to_add = rq_line dependency = rq_line.split("==")[0] for versioned_line in versioned_lines: versioned_line = versioned_line.strip() dependency_bulk = versioned_line.split("==")[0] if dependency == dependency_bulk: print(f"FOUND : {dependency} => {versioned_line}") line_to_add = versioned_line rq_versioned.append(line_to_add) rq_file_versioned.write("\n".join(rq_versioned)) rq_file_versioned.close()