mirror of
https://github.com/xonsh/xonsh.git
synced 2025-03-04 08:24:40 +01:00
add minor fixes from review
This commit is contained in:
parent
ebb21fc9c4
commit
d6c3d8a475
3 changed files with 13 additions and 16 deletions
5
setup.py
5
setup.py
|
@ -112,13 +112,14 @@ def dirty_version():
|
|||
try:
|
||||
_version = subprocess.check_output(['git', 'describe', '--tags'])
|
||||
_version = _version.decode('ascii')
|
||||
except subprocess.CalledProcessError:
|
||||
return False
|
||||
|
||||
try:
|
||||
base, N, sha = _version.strip().split('-')
|
||||
except ValueError: #on base release
|
||||
open('xonsh/dev.githash', 'w').close()
|
||||
return False
|
||||
except subprocess.CalledProcessError:
|
||||
return False
|
||||
|
||||
replace_version(base, N)
|
||||
with open('xonsh/dev.githash', 'w') as f:
|
||||
|
|
|
@ -131,18 +131,15 @@ def is_readline_available():
|
|||
|
||||
@functools.lru_cache(1)
|
||||
def githash():
|
||||
from xonsh import main
|
||||
install_base = main.__file__.rsplit('/', 1)[0]
|
||||
install_base = os.path.dirname(__file__)
|
||||
try:
|
||||
with open('{}/dev.githash'.format(install_base), 'r') as f:
|
||||
hash = f.readlines()
|
||||
if not hash:
|
||||
hash = None
|
||||
else:
|
||||
hash = hash.pop()
|
||||
sha = f.read().strip()
|
||||
if not sha:
|
||||
sha = None
|
||||
except FileNotFoundError:
|
||||
hash = None
|
||||
return hash
|
||||
sha = None
|
||||
return sha
|
||||
|
||||
|
||||
#
|
||||
|
|
|
@ -352,9 +352,8 @@ def _info(ns):
|
|||
('on cygwin', ON_CYGWIN),
|
||||
('is superuser', is_superuser()),
|
||||
('default encoding', DEFAULT_ENCODING),
|
||||
('git SHA', githash())
|
||||
])
|
||||
if githash():
|
||||
data.append(('git SHA', githash()))
|
||||
formatter = _xonfig_format_json if ns.json else _xonfig_format_human
|
||||
s = formatter(data)
|
||||
return s
|
||||
|
|
Loading…
Add table
Reference in a new issue