-
-
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/python33.6.6:/Library/Frameworks/Python.framework/Versions/3.6/bin/python33.6.6:/Library/Frameworks/Python.framework/Versions/3.6/bin/python3.6m2.7.16:/usr/bin/python2.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_IDSSH_AUTH_SOCKLC_TERMINAL_VERSIONCOLORFGBGITERM_PROFILESQLITE_EXEMPT_PATH_FROM_VNODE_GUARDSXPC_FLAGSLANGPWDSHELLTERM_PROGRAM_VERSIONTERM_PROGRAMPATHDISPLAYLC_TERMINALCOLORTERMTERMHOMETMPDIRUSERXPC_SERVICE_NAMELOGNAMEITERM_SESSION_ID__CF_USER_TEXT_ENCODINGSHLVLOLDPWDZSHPAGERLESSLSCOLORSLC_CTYPEBITBUCKET_USERBITBUCKET_PWDLC_ALLGOPATHhttp_proxyhttps_proxyswitch_variableposition_variable_PIP_DISABLE_PIP_VERSION_CHECKPYTHONDONTWRITEBYTECODEPIP_SHIMS_BASE_MODULEPIP_PYTHON_PATHPYTHONFINDER_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/binSHELL:/bin/zshLANG:zh_CN.utf-8PWD:/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": {}
}