-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Description
blank environment variable[''] behavior not associated with bash used as arguments in scripts
Issue description
when use pipenv script load envrionmnet variables as argument options , failed to use as optonial switch argument.
example script below:
pipenv version:
pipenv, version 2018.11.26
Pipfile
[[source]]
name = "pypi"
url = "https://pypi.org/simple"
verify_ssl = true
[dev-packages]
[packages]
[requires]
python_version = "3.6"
[scripts]
variable_args="./list_args.py ${switch_variable} ${position_variable}"
list_args.py
#!/usr/bin/env python
import sys
print(sys.argv)
when run :
export switch_variable='' && export position_variable='position'
pipenv run variable_args
print : ['./list_args.py', '', 'position']
if run ./list_args.py ${switch_variable} ${position_variable}
directly in sh, get result:
['./list_args.py', 'position']
Expected result
pipenv run
shold generate the same result as run in shell.
Actual result
['./list_args.py', '', 'position']
suggest
check string empty in
Lines 2462 to 2464 in 3e63f07
os.execl( | |
command_path, command_path, *[os.path.expandvars(arg) for arg in script.args] | |
) |
os.execl(
command_path, command_path, *[os.path.expandvars(arg) for arg in script.args if os.path.expandvars(arg) ]
)
Steps to replicate
Provide the steps to replicate (which usually at least includes the commands and the Pipfile).
$ pipenv --support
Pipenv version: '2018.11.26'
Pipenv location: '/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pipenv'
Python location: '/Library/Frameworks/Python.framework/Versions/3.6/bin/python3.6'
Python installations found:
3.7.3
:/usr/bin/python3
3.6.6
:/Library/Frameworks/Python.framework/Versions/3.6/bin/python3
3.6.6
:/Library/Frameworks/Python.framework/Versions/3.6/bin/python3.6m
2.7.16
:/usr/bin/python
2.7.16
:/usr/bin/pythonw
PEP 508 Information:
{'implementation_name': 'cpython',
'implementation_version': '3.6.6',
'os_name': 'posix',
'platform_machine': 'x86_64',
'platform_python_implementation': 'CPython',
'platform_release': '19.0.0',
'platform_system': 'Darwin',
'platform_version': 'Darwin Kernel Version 19.0.0: Thu Oct 17 16:17:15 PDT '
'2019; root:xnu-6153.41.3~29/RELEASE_X86_64',
'python_full_version': '3.6.6',
'python_version': '3.6',
'sys_platform': 'darwin'}
System environment variables:
TERM_SESSION_ID
SSH_AUTH_SOCK
LC_TERMINAL_VERSION
COLORFGBG
ITERM_PROFILE
SQLITE_EXEMPT_PATH_FROM_VNODE_GUARDS
XPC_FLAGS
LANG
PWD
SHELL
TERM_PROGRAM_VERSION
TERM_PROGRAM
PATH
DISPLAY
LC_TERMINAL
COLORTERM
TERM
HOME
TMPDIR
USER
XPC_SERVICE_NAME
LOGNAME
ITERM_SESSION_ID
__CF_USER_TEXT_ENCODING
SHLVL
OLDPWD
ZSH
PAGER
LESS
LSCOLORS
LC_CTYPE
BITBUCKET_USER
BITBUCKET_PWD
LC_ALL
GOPATH
http_proxy
https_proxy
switch_variable
position_variable
_
PIP_DISABLE_PIP_VERSION_CHECK
PYTHONDONTWRITEBYTECODE
PIP_SHIMS_BASE_MODULE
PIP_PYTHON_PATH
PYTHONFINDER_IGNORE_UNSUPPORTED
Pipenv–specific environment variables:
Debug–specific environment variables:
PATH
:/Users/key00000/Library/Python/3.6/bin:/Users/key00000/bin:/Library/Frameworks/Python.framework/Versions/3.6/bin:/Applications/VLC.app/Contents/MacOS/:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/usr/local/share/dotnet:/opt/X11/bin:~/.dotnet/tools:/Applications/Wireshark.app/Contents/MacOS:/Users/key00000/go/bin
SHELL
:/bin/zsh
LANG
:zh_CN.utf-8
PWD
:/tmp/pipenvvariable
Contents of Pipfile
('/private/tmp/pipenvvariable/Pipfile'):
[[source]]
name = "pypi"
url = "https://pypi.org/simple"
verify_ssl = true
[dev-packages]
[packages]
[requires]
python_version = "3.6"
[scripts]
variable_args="./list_args.py ${switch_variable} ${position_variable}"
Contents of Pipfile.lock
('/private/tmp/pipenvvariable/Pipfile.lock'):
{
"_meta": {
"hash": {
"sha256": "415dfdcb118dd9bdfef17671cb7dcd78dbd69b6ae7d4f39e8b44e71d60ca72e7"
},
"pipfile-spec": 6,
"requires": {
"python_version": "3.6"
},
"sources": [
{
"name": "pypi",
"url": "https://pypi.org/simple",
"verify_ssl": true
}
]
},
"default": {},
"develop": {}
}