Created
June 30, 2017 23:17
-
-
Save muratg/62ae4445885f57d879cd6dd1fa3b0a97 to your computer and use it in GitHub Desktop.
4 liner to get the list of nuspecs which multi-target. Usage: python nupkg_multitarget <SHIP_FOLDER_LOCATION>
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 characters
import zipfile, os, re, sys | |
for nuspec_path in [(re.sub('(\.)(\d+)\.(\d+)\.(\d+)(.)*','', f) + '.nuspec', sys.argv[1] + '\\' + f) for f in os.listdir(sys.argv[1])]: | |
with zipfile.ZipFile(nuspec_path[1], 'r') as nupkg_file, nupkg_file.open(nuspec_path[0]) as nuspec_string: | |
all_targetFrameworks = re.findall('<group targetFramework="(.*?)">', str(nuspec_string.read())) | |
if len(all_targetFrameworks) > 1: print(nuspec_path[0] + ": ["+ ", ".join(all_targetFrameworks) + "]") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment