mirror of
https://github.com/xxh/xxh
synced 2024-11-27 14:11:05 +00:00
0.3.5 wip
This commit is contained in:
parent
91c1b8c0fe
commit
8087dd44b4
3 changed files with 12 additions and 25 deletions
|
@ -62,7 +62,7 @@ The xxh is for using the xonsh shell wherever you go through the ssh.
|
|||
|
||||
The xxh is using pip and python from `xonsh.AppImage` by default. You can update pip (`pip install --upgrade pip`) and install packages ordinally: `pip install --upgrade pandas`. The packages will appear in host xxh home `~/.xxh/pip` by default.
|
||||
|
||||
To install [xontribs](https://xon.sh/xontribs.html) in xxh session use `xontrib-install <package>`. Never use `pip` or `xpip` to install xontribs! ([details](https://github.com/xonsh/xonsh/issues/3463))
|
||||
To install [xontribs](https://xon.sh/xontribs.html) in xxh session use `xpip install <package>`. Never use `pip` to install xontribs ([details](https://github.com/xonsh/xonsh/issues/3463)).
|
||||
|
||||
### How it works?
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import sys, os
|
||||
|
||||
global_settings = {
|
||||
'XXH_VERSION': '0.3.4'
|
||||
'XXH_VERSION': '0.3.5'
|
||||
}
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
|
|
@ -15,35 +15,22 @@ $PATH = [ p"$PYTHONHOME" / 'bin', $XXH_HOME ] + $PATH
|
|||
sys.path.append(str($PIP_TARGET))
|
||||
sys.path.remove('') if '' in sys.path else None
|
||||
aliases['pip'] = ['python','-m','pip']
|
||||
aliases['xpip'] = lambda args: ![echo "\n\033[0;33mTO INSTALL XONTRIBS USE: xontrib-install <package>\033[0m\n"] and ![pip @(args)]
|
||||
|
||||
def _xxh_xontrib_install(args, stdin, stdout): # https://github.com/xonsh/xonsh/issues/3463
|
||||
argp = argparse.ArgumentParser(description=f"Install xontribs", prog='xontrib-install')
|
||||
argp.add_argument('xontrib',help="pip package with xontrib")
|
||||
argp.add_argument('-f', '--force', default=False, action='store_true', help="Force install")
|
||||
argp.usage = argp.format_usage().replace('usage: ', '')
|
||||
opt = argp.parse_args(args)
|
||||
|
||||
if !(pip search -q @(opt.xontrib)).returncode:
|
||||
print(f'pip search {opt.xontrib}: not found')
|
||||
return 1
|
||||
|
||||
if not opt.force and opt.xontrib in $(pip list).split():
|
||||
print(f'pip list: {opt.xontrib} already installed, try -f option to force install')
|
||||
return 1
|
||||
|
||||
if list($PIP_XONTRIB_TARGET.glob('*')):
|
||||
pip_xontrib_tmp = str($PIP_XONTRIB_TARGET) + '_'
|
||||
def _xxh_pip(args): # https://github.com/xonsh/xonsh/issues/3463
|
||||
if args and 'install' in args and '-h' not in args and '--help' not in args:
|
||||
print('\033[0;33mRun xpip in xontrib safe mode\033[0m')
|
||||
pip_xontrib_tmp = $PIP_XONTRIB_TARGET.parent / 'xontrib-safe'
|
||||
mv @($PIP_XONTRIB_TARGET) @(pip_xontrib_tmp)
|
||||
xpip install --upgrade @(opt.xontrib)
|
||||
pip @(args)
|
||||
mkdir -p @($PIP_XONTRIB_TARGET)
|
||||
bash -c $(echo mv @(pip_xontrib_tmp + '/*') @($PIP_XONTRIB_TARGET))
|
||||
if list(pip_xontrib_tmp.glob('*')):
|
||||
bash -c $(echo mv @(pip_xontrib_tmp / '*') @($PIP_XONTRIB_TARGET))
|
||||
rm -r @(pip_xontrib_tmp)
|
||||
else:
|
||||
xpip install --upgrade @(opt.xontrib)
|
||||
pip @(args)
|
||||
|
||||
aliases['xontrib-install'] = _xxh_xontrib_install
|
||||
del _xxh_xontrib_install
|
||||
aliases['xpip'] = _xxh_pip
|
||||
del _xxh_pip
|
||||
|
||||
for plugin_path in sorted(($XXH_HOME / 'plugins').glob('*')):
|
||||
if (plugin_path / 'xonshrc.xsh').exists():
|
||||
|
|
Loading…
Reference in a new issue