conda-incubator / conda-press

Press conda packages into wheels
https://regro.github.io/conda-press-docs/
BSD 3-Clause "New" or "Revised" License
116 stars 9 forks source link

conda press --fatten fails on Windows due to `rm` command not found. #57

Open SylvainCorlay opened 4 years ago

SylvainCorlay commented 4 years ago

conda press --fatten fails on Windows due to rm command not found.

Here is the full error message:

xonsh: For full traceback set: $XONSH_SHOW_TRACEBACK = True
xonsh: subprocess mode: command not found: rm
Did you mean one of the following?
    md:  Alias
    rd:  Alias
    cd:  Alias
    fg:  Alias
    bg:  Alias
Traceback (most recent call last):
  File "Miniconda3\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "Miniconda3\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "Miniconda3\lib\site-packages\conda_press\__main__.py", line 3, in <module>
    main()
  File "Miniconda3\lib\site-packages\conda_press\main.xsh", line 77, in main
    run_convert_wheel(ns.files, config)
  File "Miniconda3\lib\site-packages\conda_press\main.xsh", line 87, in run_convert_wheel
    seen, output=config.output, skipped_deps=config.exclude_deps
  File "Miniconda3\lib\site-packages\conda_press\wheel.xsh", line 803, in fatten_from_seen
    rmtree('tmp-wheels')
  File "Miniconda3\lib\site-packages\xonsh\lib\os.xsh", line 33, in rmtree
    ![rm @(cmd_args) @(dirname)]
  File "Miniconda3\lib\site-packages\xonsh\__amalgam__.py", line 22475, in subproc_captured_hiddenobject
    return run_subproc(cmds, captured="hiddenobject")
  File "Miniconda3\lib\site-packages\xonsh\__amalgam__.py", line 22438, in run_subproc
    command.end()
  File "Miniconda3\lib\site-packages\xonsh\__amalgam__.py", line 15680, in end
    self._end(tee_output=tee_output)
  File "Miniconda3\lib\site-packages\xonsh\__amalgam__.py", line 15699, in _end
    self._raise_subproc_error()
  File "Miniconda3\lib\site-packages\xonsh\__amalgam__.py", line 15825, in _raise_subproc_error
    raise subprocess.CalledProcessError(rtn, spec.args, output=self.output)
subprocess.CalledProcessError: Command '['rm', '-r', 'tmp-wheels']' returned non-zero exit status 1.
SylvainCorlay commented 4 years ago

It appears to be a bug in xonsh:

https://github.com/xonsh/xonsh/blob/92cdb8fbcae11bb1832cd7e1d76ed2338027156c/xonsh/lib/os.xsh#L17

    try:
        ![rm @(cmd_args) @(dirname)]
    except PermissionError:
        if sys.platform == "win32":
            ![del /F/S/Q @(dirname)]
        else:
            raise

it is only falling back to the windows implementation on PermissionError

marcelotrevisani commented 4 years ago

I think we need to wait for a new release of xonsh then

scopatz commented 4 years ago

Oh yeah, this bug has been fixed and we are waiting for a new release