Opened 3 years ago

Closed 3 years ago

#25660 closed enhancement (wontfix)

adding command line option to display python major version

Reported by: chapoton Owned by:
Priority: major Milestone: sage-duplicate/invalid/wontfix
Component: scripts Keywords:
Cc: embray, jdemeyer, fbissey Merged in:
Authors: Frédéric Chapoton Reviewers:
Report Upstream: N/A Work issues:
Branch: public/25660 (Commits) Commit: 79e4734c651116ec8613e83fef4d9f4721655126
Dependencies: Stopgaps:

Description

so that the patchbot will be able to tell this in the reports.

Change History (7)

comment:1 Changed 3 years ago by chapoton

  • Branch set to public/25660
  • Commit set to 138c3e4374c4212e42c9a34c90c5f86a0f3393b1
  • Status changed from new to needs_review

New commits:

138c3e4adding command line option to see if using python3

comment:2 follow-up: Changed 3 years ago by jdemeyer

  • Status changed from needs_review to needs_info

I find --which a horrible name: who would guess that ./sage --which returns the Python major version number?

Why not be explicit and use --python-version? If it's mainly for scripts, the longer name doesn't matter.

One may even wonder if the new option is needed at all: the patchbot could instead use ./sage --python --version. That would return Python 2.7.15 instead of 2 but surely that can be dealt with.

comment:3 in reply to: ↑ 2 Changed 3 years ago by fbissey

Replying to jdemeyer:

I find --which a horrible name: who would guess that ./sage --which returns the Python major version number?

+1

Why not be explicit and use --python-version? If it's mainly for scripts, the longer name doesn't matter.

+1

One may even wonder if the new option is needed at all: the patchbot could instead use ./sage --python --version. That would return Python 2.7.15 instead of 2 but surely that can be dealt with.

I guess it is easier to parse but I'd rather have complete info myself. I may wanting if python has been updated or not for example.

comment:4 Changed 3 years ago by chapoton

I am trying to use this in a patchbot

def get_python_version(sage_cmd):
    """
    get the python version run by sage
    """
    res = subprocess.check_output([sage_cmd,
                                   "--python", "--version"],
                                  stderr=subprocess.STDOUT)
    return res

and this fails by always giving me 'Python 2.7.15\n' even when sage_cmd is the sage in my sage3 install.

comment:5 Changed 3 years ago by git

  • Commit changed from 138c3e4374c4212e42c9a34c90c5f86a0f3393b1 to 79e4734c651116ec8613e83fef4d9f4721655126

Branch pushed to git repo; I updated commit sha1. New commits:

79e4734better name "--python-version"

comment:6 follow-up: Changed 3 years ago by chapoton

  • Milestone changed from sage-8.3 to sage-duplicate/invalid/wontfix
  • Status changed from needs_info to needs_review

ok, maybe we can just close this one as invalid. Patchbot seems to be working correctly with "--python --version"...

comment:7 in reply to: ↑ 6 Changed 3 years ago by embray

  • Resolution set to wontfix
  • Status changed from needs_review to closed

Replying to chapoton:

ok, maybe we can just close this one as invalid. Patchbot seems to be working correctly with "--python --version"...

This was my thought exactly when I saw this ticket :) But thanks for thinking to add it, it will be helpful.

Note: See TracTickets for help on using tickets.