New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Re-Fix standard_packages(), optional_packages(), and experimental_packages() #18456
Comments
Branch: u/ncohen/18456 |
This comment has been minimized.
This comment has been minimized.
Branch pushed to git repo; I updated commit sha1. Last 10 new commits:
|
Commit: |
Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:
|
comment:4
I insstalled the branch and did "make" which rebuilt a very large amount. Then
gave
which also failed. SO I don't exactly know what it is that I am supposed to be testing! |
comment:5
Hello !
This is suspicious. As you can see from the branch's diff, it only touches one file (i.e. sage/misc/package.py) which is not a dependency of anything as far as I know. I just did a checkout on the branch, and no recompilation was triggered at all.
This branch fixes the three functions In order to fix That would require changing the output or Nathann |
comment:6
You are right to be suspicious. I was starting from 6.8.beta0, while I think that the branch branched off from 6.7 -- right? That would explain the extra rebuilding. |
comment:7
Yep, totally. If it can be of interest to you, I use a short bash script that downloads a branch for me, and merges it with my current beta. This way, I never go back to an earlier version of sage and I avoid these problems. About I can add it to this ticket if you want. Nathann |
comment:8
Replying to @nathanncohen:
Well, if it doesn't work as is then it cannot get a positive review anyway, so I have changed it to "needs work" and can try again after you have added what is needed to make it work!
|
comment:9
You got me wrong: it does not work in the latest beta either. None of the two work. And this ticket fixes one of the two. Nathann |
comment:11
Again: if you want I can add this other commit. It makes 'sage -standard' call the functions I fix in this branch and display the list of packages (though without the version number). Nathann |
comment:12
Sorry, I ran out of time on this and have to go to give an exam (and grade 257 scripts) now. For whoever comes next to the ticket, you will have to explain better why something known not to work is still on "needs review" since I don't understand! |
comment:13
I do not know where you got the idea that this branch breaks anything. If you tell me what, I can surely explain. This branch fixes three functions, as advertised in the ticket's title. Nathann |
comment:14
I believe we should fix I'm okay with the output on |
comment:15
Replying to @nathanncohen:
I don't agree with this: ideally, |
comment:16
Hello guys, I wrote this fix for Right now, everything is broken. And I personally prefer by far to have the Nathann |
comment:17
Just to make sure I understand: the original purpose of this ticket was to fix For ease of maintenance (and for cleanliness of code, which isn't quite as important), it would be best to not duplicate the work, so it would be best to have That's my opinion, but I don't feel that strongly about the code duplication, so I personally won't object if this ticket only fixes (In my brief tests, by the way, this does fix the Sage functions as intended. But I haven't looked at the actual changes to see if they make sense.) |
comment:18
Hello !
+1
That's what I tried first, i.e. fix I thought a bit about making this script dependent on sage, and I actually ended up wondering whether .... we need those
I hope that they do Nathann |
comment:19
Okay. Third fix. This one fixes the three functions AND the When it will be reviewed, I will be able to add a cool feature: automatic test of (installed) optional packages. Needs review again, Nathann |
comment:22
What do you think about either of these changes? diff --git a/src/bin/sage-list-packages b/src/bin/sage-list-packages
index 5b17272..e1b0889 100755
--- a/src/bin/sage-list-packages
+++ b/src/bin/sage-list-packages
@@ -16,7 +16,12 @@ SAGE_ROOT = os.environ["SAGE_ROOT"]
# Input parsing #
#################
-parser = argparse.ArgumentParser(description="List Sage's packages")
+parser = argparse.ArgumentParser(formatter_class=argparse.RawDescriptionHelpFormatter,
+ description="""List Sage's packages, by default in the format
+
+ {:.<30} {}
+
+""".format("package", "version on-line (version installed)"))
parser.add_argument('category', choices=['standard','optional','experimental', 'installed'], metavar="category",
help="The type of packages. Can be 'standard','optional','experimental' or 'installed'.")
parser.add_argument('--dump', dest='dump', default=False, action='store_true',
@@ -76,6 +81,10 @@ if args['remote'] and args['category']!='installed':
# OUTPUT #
##########
+if not args['dump']:
+ print("{:.<40} {}".format("PACKAGE", "version on-line (version installed)"))
+ print("-"*76)
+
# installed
if args['category'] == 'installed':
if args['version']: I ask because when I ran
in the output meant. |
comment:23
This change is more important. diff --git a/src/bin/sage-list-packages b/src/bin/sage-list-packages
index 5b17272..88cbaab 100755
--- a/src/bin/sage-list-packages
+++ b/src/bin/sage-list-packages
@@ -46,12 +51,12 @@ installed = dict(pkgname_split(pkgname)
for pkgname in os.listdir(SAGE_SPKG_INST))
# new-style packages
-local_non_filtered = os.listdir(SAGE_ROOT+"/build/pkgs/")
+local_non_filtered = os.listdir(os.path.join(SAGE_ROOT, "build", "pkgs"))
local = {}
for p in local_non_filtered:
- with open(SAGE_ROOT+"/build/pkgs/"+p+"/package-version.txt") as f:
+ with open(os.path.join(SAGE_ROOT, "build", "pkgs", p, "package-version.txt")) as f:
version = f.read().strip()
- with open(SAGE_ROOT+"/build/pkgs/"+p+"/type") as f:
+ with open(os.path.join(SAGE_ROOT, "build", "pkgs", p, "type")) as f:
if f.read().strip() == args['category']:
local[p] = version
I can create a new branch with this change and either of the earlier ones if you want. Or you can do it. |
comment:24
There are no doctests for For
If
Since this function would be quite different from |
Branch pushed to git repo; I updated commit sha1. New commits:
|
comment:26
I added a commit that displays column names when '--dump' is not used. The columns change a lot depending on which flags are used, and so this code is not exactly the one you proposed. Nathann |
Branch pushed to git repo; I updated commit sha1. New commits:
|
comment:28
Right. Done. Nathann |
comment:29
Fixed.
I do not mind, you can open a ticket if you need this feature.
Two private functions that do almost the same job? Let's keep things simple, one is enough. Nathann |
comment:30
Replying to @nathanncohen:
Done: #18581 |
Branch pushed to git repo; I updated commit sha1. New commits:
|
comment:32
I get an error with the new doctest:
The problem is that diff --git a/src/sage/misc/package.py b/src/sage/misc/package.py
index 12b556d..91ab594 100644
--- a/src/sage/misc/package.py
+++ b/src/sage/misc/package.py
@@ -239,9 +239,7 @@ def _package_lists_from_sage_output(package_type,version=False,local=False):
sage: installed, not_installed = _package_lists_from_sage_output('standard',local=True,version=True)
sage: bool(not_installed)
False
- sage: any(x[0] == 'glpk' for x in installed)
- True
- sage: type(x[1]) == str and '4.55' <= x[1]
+ sage: any(x[0] == 'glpk' and type(x[1]) == str and '4.55' <= x[1] for x in installed)
True
"""
if package_type not in ['standard','optional','experimental']: |
Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:
|
comment:34
Rightrightright, thanks! I updated the latest commit. Nathann |
comment:35
This looks good to me. Anyone else have any issues, or can we set it to positive review? |
Reviewer: John Palmieri |
Changed branch from u/ncohen/18456 to |
What was fixed in #18407 (one week ago) has been broken since
:-P
That's because the website went mostly down. Also, that new version handles both old-style spkg and new-style spkg.
Nathann
Depends on #18431
CC: @nexttime @vbraun @jdemeyer
Component: distribution
Author: Nathann Cohen
Branch/Commit:
b093007
Reviewer: John Palmieri
Issue created by migration from https://trac.sagemath.org/ticket/18456
The text was updated successfully, but these errors were encountered: