Error in configure on Windows when there is a space in the path name
goneall opened this issue · 3 comments
To reproduce:
- on Windows create a directory with a space in the name (e.g. C:\Users\me\this has a space\aboutcode)
- Clone the development version of aboutcode-toolkit (commit ac509e1 at the time of this issue)
- Run
configure
An error indicating a path or file not found will occur.
Workaround: Use in a directory without spaces
@pombredanne I need help on this.
I turned on the echo and figured something strange happen in this line https://github.com/nexB/aboutcode-toolkit/blob/develop/configure.bat#L94
I tried to run the configure
with space in path and get the following
C:\Users\thoma\Desktop\tmp\New folder\aboutcode-toolkit>if not defined PYTHON_EXECUTABLE (
if exist ""C:\Users\thoma\Desktop\tmp\New folder\aboutcode-toolkit\\PYTHON_EXECUTABLE"" (
set /p PYTHON_EXECUTABLE= folder\aboutcode-toolkit\\PYTHON_EXECUTABLE"" 0<""C:\Users\thoma\Desktop\tmp\New
) else (set "PYTHON_EXECUTABLE=py" )
'folder\aboutcode-toolkit\\PYTHON_EXECUTABLE""' is not recognized as an internal or external command,
operable program or batch file.
Access is denied.
This is the problematic command: set /p PYTHON_EXECUTABLE= folder\aboutcode-toolkit\\PYTHON_EXECUTABLE"" 0<""C:\Users\thoma\Desktop\tmp\New
I don't know why the path is splitted, and it seems to me the 2nd half of the path (after the space) is treated as the user defined python exe from the /p
option. I believe the script is properly quoted? set /p PYTHON_EXECUTABLE=<""%CFG_ROOT_DIR%\PYTHON_EXECUTABLE""
For reference, this is the configure
log when running with path without spaces.
C:\Users\thoma\git\aboutcode-toolkit>if not defined PYTHON_EXECUTABLE (
if exist ""C:\Users\thoma\git\aboutcode-toolkit\\PYTHON_EXECUTABLE"" (set /p PYTHON_EXECUTABLE= 0<""C:\Users\thoma\git\aboutcode-toolkit\\PYTHON_EXECUTABLE"" ) else (set "PYTHON_EXECUTABLE=py" )
)
After playing around with some quote, I am able to make the configure
script run. However, the venv's about
command is still having issue:
(venv) C:\Users\thoma\Desktop\tmp\New folder\aboutcode-toolkit>configure
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 10.6M 100 10.6M 0 0 29.2M 0 --:--:-- --:--:-- --:--:-- 29.2M
created virtual environment CPython3.8.3.final.0-64 in 6893ms
creator CPython3Windows(dest=C:\Users\thoma\Desktop\tmp\New folder\aboutcode-toolkit\venv, clear=False, no_vcs_ignore=True, global=False)
seeder PipInvoke(download=False, pip=embed, setuptools=embed, wheel=embed)
added seed packages: pip==22.0.3, setuptools==60.6.0, wheel==0.37.1
activators BashActivator,BatchActivator,FishActivator,NushellActivator,PowerShellActivator,PythonActivator
Looking in links: c:\Users\thoma\Desktop\tmp\New folder\aboutcode-toolkit\\thirdparty, https://thirdparty.aboutcode.org/pypi
Obtaining file:///C:/Users/thoma/Desktop/tmp/New%20folder/aboutcode-toolkit
Checking if build backend supports build_editable ... done
Preparing metadata (pyproject.toml) ... done
warning: bad-index-doctype
× The package index page being used does not have a proper HTML doctype declaration.
╰─> Problematic URL: https://thirdparty.aboutcode.org/pypi/
note: This is an issue with the page at the URL mentioned above.
hint: You might need to reach out to the owner of that package index, to get this fixed. See https://github.com/pypa/pip/issues/10825 for context.
Collecting boolean.py<4.0,>=3.5
Using cached https://thirdparty.aboutcode.org/pypi/boolean.py-3.8-py2.py3-none-any.whl (23 kB)
Collecting license-expression>=0.94
Using cached https://thirdparty.aboutcode.org/pypi/license_expression-21.6.14-py3-none-any.whl (86 kB)
Collecting saneyaml
Using cached https://thirdparty.aboutcode.org/pypi/saneyaml-0.5.2-py3-none-any.whl (11 kB)
Collecting jinja2
Using cached https://thirdparty.aboutcode.org/pypi/Jinja2-3.0.1-py3-none-any.whl (133 kB)
Collecting attrs
Using cached https://thirdparty.aboutcode.org/pypi/attrs-21.2.0-py2.py3-none-any.whl (53 kB)
Collecting openpyxl
Using cached https://thirdparty.aboutcode.org/pypi/openpyxl-3.0.8-py2.py3-none-any.whl (244 kB)
Collecting click
Using cached https://thirdparty.aboutcode.org/pypi/click-8.0.1-py3-none-any.whl (97 kB)
Collecting packageurl-python>=0.9.0
Using cached https://thirdparty.aboutcode.org/pypi/packageurl_python-0.9.4-py2.py3-none-any.whl (23 kB)
Collecting certifi
Using cached https://thirdparty.aboutcode.org/pypi/certifi-2021.10.8-py2.py3-none-any.whl (149 kB)
Collecting colorama
Using cached https://thirdparty.aboutcode.org/pypi/colorama-0.4.4-py2.py3-none-any.whl (16 kB)
Collecting MarkupSafe>=2.0
Using cached https://thirdparty.aboutcode.org/pypi/MarkupSafe-2.0.1-cp38-cp38-win_amd64.whl (14 kB)
Collecting et-xmlfile
Using cached https://thirdparty.aboutcode.org/pypi/et_xmlfile-1.1.0-py3-none-any.whl (4.7 kB)
Collecting PyYAML
Using cached https://thirdparty.aboutcode.org/pypi/PyYAML-6.0-cp38-cp38-win_amd64.whl (155 kB)
Installing collected packages: packageurl-python, certifi, boolean.py, PyYAML, MarkupSafe, license-expression, et-xmlfile, colorama, attrs, saneyaml, openpyxl, jinja2, click, aboutcode-toolkit
Running setup.py develop for aboutcode-toolkit
Successfully installed MarkupSafe-2.0.1 PyYAML-6.0 aboutcode-toolkit-6.0.1.dev217+gac509e1.d20220217 attrs-21.2.0 boolean.py-3.8 certifi-2021.10.8 click-8.0.1 colorama-0.4.4 et-xmlfile-1.1.0 jinja2-3.0.1 license-expression-21.6.14 openpyxl-3.0.8 packageurl-python-0.9.4 saneyaml-0.5.2
Junction created for C:\Users\thoma\Desktop\tmp\New folder\aboutcode-toolkit\\venv\bin <<===>> C:\Users\thoma\Desktop\tmp\New folder\aboutcode-toolkit\\venv\Scripts
(venv) C:\Users\thoma\Desktop\tmp\New folder\aboutcode-toolkit>venv\bin\activate
(venv) C:\Users\thoma\Desktop\tmp\New folder\aboutcode-toolkit>about --help
'#' is not recognized as an internal or external command,
operable program or batch file.
'folder\aboutcode-toolkit\\venv\Scripts\python.exe' is not recognized as an internal or external command,
operable program or batch file.
'C:\Users\thoma\Desktop\tmp\New' is not recognized as an internal or external command,
operable program or batch file.
C:\Users\thoma\Desktop\tmp\New folder\aboutcode-toolkit\\venv\bin\about --help
'C:\Users\thoma\Desktop\tmp\New' is not recognized as an internal or external command,
operable program or batch file.
(venv) C:\Users\thoma\Desktop\tmp\New folder\aboutcode-toolkit>venv\bin\about.exe --help
Usage: about [OPTIONS] COMMAND [ARGS]...
Generate licensing attribution and credit notices from .ABOUT files and
inventories.
Read, write and collect provenance and license inventories from .ABOUT files
to and from JSON or CSV files.
Use about <command> --help for help on a command.
Options:
--version Show the version and exit.
-h, --help Show this message and exit.
Commands:
attrib Generate an attribution document from
JSON/CSV/Excel/.ABOUT files.
check Validate that the format of .ABOUT files is correct and
report errors and warnings.
collect-redist-src Collect redistributable sources.
gen Generate .ABOUT files from an inventory as
CSV/JSON/Excel.
gen-license Fetch and save all the licenses in the
license_expression field to a directory.
inventory Collect the inventory of .ABOUT files to a
CSV/JSON/Excel file.
transform Transform a CSV/JSON/Excel by applying renamings,
filters and checks.
(venv) C:\Users\thoma\Desktop\tmp\New folder\aboutcode-toolkit>
Fixed in 15a3174