Closed Bug 1688201 Opened 5 years ago Closed 4 years ago

`FileNotFoundError` when upgrading moz-phab on Windows

Categories

(Conduit :: moz-phab, defect, P2)

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: mhentges, Assigned: mhentges)

References

Details

(Keywords: conduit-triaged)

Attachments

(1 file)

Sentry ticket.
This is affecting multiple people, as there are many server_names affected.

In Barret's description of the bug in Slack today: they ran a moz-phab command, tried to auto-update, then crashed. Fortunately, re-running their command the second time succeeds. I'm assuming that this means that though auto-update threw an exception, the actual version of moz-phab was properly updated.

Assignee: nobody → zeid
Keywords: conduit-triaged
Priority: -- → P2

I've apparently been stuck on 0.1.92 for ages because the self update doesn't actually completely run pip.

Here is a stack trace from moz-phab self-update --debug:

  File "c:\python37\lib\site-packages\mozphab\mozphab.py", line 88, in main
    args.func(args)
  File "c:\python37\lib\site-packages\mozphab\commands\self_update.py", line 17, in self_update
    self_upgrade()
  File "c:\python37\lib\site-packages\mozphab\updater.py", line 148, in self_upgrade
    exe.rename(temp_exe)
  File "c:\python37\lib\pathlib.py", line 1319, in rename
    self._accessor.rename(self, target)
FileNotFoundError: [WinError 3] The system cannot find the path specified: 'C:\\Python37\\Scripts\\moz-phab.exe\\moz-phab.exe' -> 'C:\\Python37\\Scripts\\moz-phab.exe\\moz-phab-temp.exe'

I did some debugging and script_module.__file__ resolves to C:\Python37\Scripts\moz-phab.exe\__main__.py which doesn't exist because C:\Python37\Scripts\moz-phab.exe is an executable, not a directory.

I'm seeing more people CC to this, so I took a closer look with Barret's help.

Reproduce steps:

  1. Install MozillaBuild
  2. pip3 install wheel
  3. pip3 install mozphab
  4. moz-phab self-update.

Workaround

  1. pip3 uninstall wheel
  2. pip3 install --no-cache mozphab
  3. moz-phab self-update

The issue is in the way that moz-phab tries to identify its entry point script.
It does so by resolving __main__, assumes that that's a file in Scripts (or bin), and operates in that directory accordingly.
Unfortunately, when using wheel, setuptools can cause __main__ to point to an invalid file (Scripts/moz-phab.exe/__main__.py). Things unravel from here.

Work around setuptools bug where the "main" module's
path refers to the entry point as a directory, not a file.

Assignee: zeid → mhentges
Status: NEW → ASSIGNED
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
See Also: → 1774074
Regressions: 1774074
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: