Skip to content

Commit

Permalink
can now search for packages and specify args in requirements
Browse files Browse the repository at this point in the history
  • Loading branch information
mobeets committed Jan 15, 2017
1 parent d3d9743 commit f6bacd8
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 12 deletions.
1 change: 0 additions & 1 deletion find_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
15 changes: 7 additions & 8 deletions mpm.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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."
Expand Down
6 changes: 3 additions & 3 deletions requirements-example.txt
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit f6bacd8

Please sign in to comment.