#19187: Add rules for installing packages with pip
-------------------------------------+-------------------------------------
Reporter: jdemeyer | Owner:
Type: enhancement | Status: needs_work
Priority: critical | Milestone: sage-6.9
Component: build | Resolution:
Keywords: | Merged in:
Authors: Jeroen Demeyer | Reviewers:
Report Upstream: N/A | Work issues:
Branch: | Commit:
u/jdemeyer/ticket/19187 | fdba3ee0772b1885c3f60cb35f850fee576a7f9a
Dependencies: #19119 | Stopgaps:
-------------------------------------+-------------------------------------
Comment (by jhpalmieri):
Although we can check existing optional packages to see if they've been
installed by pip:
{{{
#!diff
diff --git a/src/bin/sage-list-packages b/src/bin/sage-list-packages
index e809e40..9162a30 100755
--- a/src/bin/sage-list-packages
+++ b/src/bin/sage-list-packages
@@ -5,7 +5,7 @@
from __future__ import print_function
-import os, sys, argparse, re
+import os, argparse, re, subprocess
from string import join
if "SAGE_ROOT" not in os.environ:
@@ -98,13 +98,26 @@ if args['category'] == 'installed':
# Any other categories
else:
if args['version']:
+ try:
+ pip_output = subprocess.check_output(['pip', 'list'],
stderr=subprocess.STDOUT)
+ except CalledProcessError:
+ pip_output = ''
+
# Display the columns' name
if not args['dump']:
print("{:.<40} {} ({})\n".format("[package] ", "[latest
version]",
"[installed version]"))
for p in sorted(set(local).union(remote)):
+ if p in installed:
+ installed_version = installed[p]
+ else:
+ s = re.search('\n{}.*\((.*)\)\n'.format(p), pip_output)
+ if s:
+ installed_version = s.groups(0)[0]
+ else:
+ installed_version = 'not_installed'
line = [p, local.get(p, remote.get(p, 'not_found')),
- installed.get(p, 'not_installed')]
+ installed_version]
if args['dump']:
print(join(line, ' '))
else:
}}}
(This is not a complete patch, just an idea.)
--
Ticket URL: <http://trac.sagemath.org/ticket/19187#comment:20>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.