Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
src/bin/sage-venv-config: New
Browse files Browse the repository at this point in the history
  • Loading branch information
mkoeppe committed Nov 13, 2020
1 parent 3695ede commit c90c969
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 0 deletions.
1 change: 1 addition & 0 deletions build/pkgs/sagelib/src/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@
'bin/sage-massif',
'bin/sage-omega',
'bin/sage-valgrind',
'bin/sage-venv-config',
'bin/sage-version.sh',
'bin/sage-cleaner',
## Only makes sense in sage-the-distribution. TODO: Move to another installation script.
Expand Down
27 changes: 27 additions & 0 deletions src/bin/sage-venv-config
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#! /doesnotexist/python3

try:
from sage_conf import *
except ImportError:
pass

from sys import prefix as SAGE_VENV

def _main():
from argparse import ArgumentParser
from sys import exit, stdout
parser = ArgumentParser()
parser.add_argument('--version', help="show version", action="version",
version='%(prog)s ' + VERSION)
parser.add_argument("VARIABLE", nargs='?', help="output the value of VARIABLE")
args = parser.parse_args()
d = globals()
if args.VARIABLE:
stdout.write('{}\n'.format(d[args.VARIABLE]))
else:
for k, v in d.items():
if not k.startswith('_'):
stdout.write('{}={}\n'.format(k, v))

if __name__ == "__main__":
_main()
1 change: 1 addition & 0 deletions src/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@
'bin/sage-massif',
'bin/sage-omega',
'bin/sage-valgrind',
'bin/sage-venv-config',
'bin/sage-version.sh',
'bin/sage-cleaner',
## Only makes sense in sage-the-distribution. TODO: Move to another installation script.
Expand Down

0 comments on commit c90c969

Please sign in to comment.