Skip to content

Instantly share code, notes, and snippets.

@gimmi
Created July 12, 2013 14:14
Show Gist options
  • Save gimmi/5984766 to your computer and use it in GitHub Desktop.
Save gimmi/5984766 to your computer and use it in GitHub Desktop.
import os, glob, shutil, subprocess
base_path = os.path.join(os.getcwd(), 'GesDB')
pkgs_path = os.path.join(base_path, 'packages')
os.path.relpath('c:\sviluppo\dir\packages', 'c:\sviluppo\dir')
for sln_path, directories, files in os.walk(base_path):
if not [f for f in files if f.lower().endswith(".sln")]: continue
pkgs_rel_path = os.path.relpath(pkgs_path, sln_path)
print(sln_path + ' => ' + pkgs_rel_path)
cfg_content = """\
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<config>
<add key="repositoryPath" value="%s" />
</config>
</configuration>
""" % pkgs_rel_path
with open(os.path.join(sln_path, 'NuGet.config'), 'w') as f:
f.write(cfg_content)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment