From f6bacd8fbf7751136c2d4c69ce746edc4adc5f5e Mon Sep 17 00:00:00 2001 From: mobeets Date: Sun, 15 Jan 2017 12:55:02 -0500 Subject: [PATCH] can now search for packages and specify args in requirements --- find_package.py | 1 - mpm.py | 15 +++++++-------- requirements-example.txt | 6 +++--- 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/find_package.py b/find_package.py index 016ebc4..8ee670d 100644 --- a/find_package.py +++ b/find_package.py @@ -43,7 +43,6 @@ def get_zipball_from_url(repo, url): return data['zipball_url'] def find_matlabcentral_repo(query): - # http://www.mathworks.com/matlabcentral/fileexchange/22022-matlab2tikz-matlab2tikz query_html = urllib2.quote(query) url = 'http://www.mathworks.com/matlabcentral/fileexchange/?term={0}'.format(query_html) response = urllib2.urlopen(url) diff --git a/mpm.py b/mpm.py index 76232e2..0e2388e 100644 --- a/mpm.py +++ b/mpm.py @@ -90,12 +90,10 @@ def main(url, name, outdir, force, allow_nesting, internaldir, searchonly, githu else: print "Could not find any package named '{0}' on Github with version {1}.".format(name, version) return - if searchonly: - print 'Package "{0}" found at "{1}". Not installing.'.format(name, url) - return - else: - print 'Package "{0}" found at "{1}".'.format(name, url) - return + print 'Package "{0}" found at "{1}".'.format(name, url) + if searchonly: + print 'Not installing "{0}" because user specified "searchonly".'.format(name) + return url = url.strip() name = name.strip() if not os.path.exists(outdir): @@ -138,19 +136,20 @@ def load_from_file(infile, outdir, force, searchonly): extra_args += ' --searchonly' with open(infile) as f: for i, line in enumerate(f.readlines()): + if not line.strip(): # empty line + continue args = line.split() msgs = check_args_in_file(args, i+1) for msg in msgs: print 'WARNING: ' + msg args += extra_args.split() - print ' '.join(args) - continue call(['python', mpmpath] + args) def check_args(args): msgs = [] if not args.reqsfile and not args.name: msg = "Must provide a package name" + print args msgs.append(msg) if args.reqsfile and args.version: msg = "Specifying a version is not allowed when loading from requirements file." diff --git a/requirements-example.txt b/requirements-example.txt index 771294c..44aae9b 100644 --- a/requirements-example.txt +++ b/requirements-example.txt @@ -1,3 +1,3 @@ -export-fig http://www.mathworks.com/matlabcentral/fileexchange/23629-export-fig?download=true -cbrewer http://www.mathworks.com/matlabcentral/fileexchange/34087-cbrewer---colorbrewer-schemes-for-matlab -matlab2tikz https://github.com/matlab2tikz/matlab2tikz.git +export_fig http://www.mathworks.com/matlabcentral/fileexchange/23629-export-fig +matlab2tikz -v 1.0.0 +colorbrewer