Skip to content

Instantly share code, notes, and snippets.

@muratg
Created June 30, 2017 23:17
Show Gist options
  • Save muratg/62ae4445885f57d879cd6dd1fa3b0a97 to your computer and use it in GitHub Desktop.
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>
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