Closed Bug 1606175 Opened 4 years ago Closed 4 years ago

moz-phab fails auto update on Windows

Categories

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

defect

Tracking

(Not tracked)

RESOLVED WORKSFORME

People

(Reporter: emk, Assigned: zalun)

Details

(Keywords: conduit-triaged)

Attachments

(1 file)

$ moz-phab
Updating libphutil...
Update of libphutil not required
Updating arcanist...
Update of arcanist not required
Upgrading to version 0.1.71
Collecting MozPhab
  Downloading https://files.pythonhosted.org/packages/e1/ca/2f5936ad3263c6b230ad634760629f3d11f2f3c47128d19e6259834ce402/MozPhab-0.1.71.tar.gz (56kB)
     |████████████████████████████████| 61kB ...
Requirement already satisfied, skipping upgrade: setuptools in d:\mozilla-build\python3\lib\site-packages (from MozPhab) (41.4.0)
Installing collected packages: MozPhab
  Found existing installation: MozPhab 0.1.68
    Uninstalling MozPhab-0.1.68:
ERROR: Could not install packages due to an EnvironmentError: [WinError 5] アクセスが拒否されました。: 'd:\\mozilla-build\\python3\\scripts\\moz-phab.exe'
Consider using the `--user` option or check the permissions.

CommandError: command 'd:\mozilla-build\python3\python3.exe' failed to complete successfully

$ moz-phab
Cannot open d:\mozilla-build\python3\Scripts\moz-phab-script.py

$

I had to run pip3 install MozPhab to recover.

This is a different issue from bug 1591048.

Hmm, interesting - how did you install MozPhab the first time? Did you pip3 install MozPhab, was it installed from mach bootstrap/mach vcs-setup, or did you install it manually?

Also, FWIW, is d:\\mozilla-build\\python3\\scripts only writable by an admin?

Flags: needinfo?(VYV03354)

(In reply to Mitchell Hentges [:mhentges] from comment #1)

Hmm, interesting - how did you install MozPhab the first time? Did you pip3 install MozPhab, was it installed from mach bootstrap/mach vcs-setup, or did you install it manually?

I installed moz-phab manually when it was a one-file script.
(By the way, will ./mach bootstrap install MozPhab? It only shows a URL about an installation instruction for me.)

Also, FWIW, is d:\\mozilla-build\\python3\\scripts only writable by an admin?

It is writable by all users. pip3 install MozPhab installed MozPhab to that directory without any problems.

Flags: needinfo?(VYV03354)

I installed moz-phab manually when it was a one-file script.

:emk, Is the moz-phab at d:\\mozilla-build\\python3\\scripts\\moz-phab.exe the one that you installed manually, or have you since done pip install MozPhab (and pip put it there)?

(By the way, will ./mach bootstrap install MozPhab? It only shows a URL about an installation instruction for me.)

IIRC ./mach bootstrap used to install moz-phab itself, but I could be mistaken.


Looking into our self-upgrade code, I'm seeing this

        self_file = Path(__file__).resolve()
        user_file = Path(site.getuserbase()).resolve() / "bin" / self_file.name
        if self_file == user_file:
            command.append("--user")

This looks like it could be a *nix-specific assumption? I'm going to leave this ticket for zalun/glob, who are more familiar with the self-update implementation :)

Flags: needinfo?(VYV03354)

(In reply to Mitchell Hentges [:mhentges] from comment #3)

I installed moz-phab manually when it was a one-file script.

:emk, Is the moz-phab at d:\\mozilla-build\\python3\\scripts\\moz-phab.exe the one that you installed manually, or have you since done pip install MozPhab (and pip put it there)?

It was moz-phab (no extension, a python script.) I created %userprofile%\phabricator directory manually and put the moz-phab file manually. The install instruction at that point said that I can put the script anywhere as long as the %PATH% is set correctly.

The script automatically updated to the multi-file version a while ago. Auto-update worked several times until I encounter this bug.

Flags: needinfo?(VYV03354)
Keywords: conduit-triaged
Priority: -- → P2

user_file = Path(site.getuserbase()).resolve() / "bin" / self_file.name
This looks like it could be a *nix-specific assumption?

I had to find the scripts path for another project; here's code that works on MacOS, Linux, and MozillaBuild:

from distutils.dist import Distribution
d = Distribution()
d.parse_config_files()
i = d.get_command_obj('install', create=True)
i.user = False
i.finalize_options()
scripts_path = i.install_scripts

Setting i.user = True will return the path to --user installed scripts.

Assignee: nobody → pzalewa

Today this happened again. I guess this will happen ever time moz-phab updates.

$ moz-phab self-update
Updating libphutil...
libphutil updated
Updating arcanist...
Update of arcanist not required
Collecting MozPhab
  Downloading https://files.pythonhosted.org/packages/17/25/1c0b9c654d9bd623404c5b561a65e255c3beba67c52d6786e7a135523c2b/MozPhab-0.1.73.tar.gz (57kB)
     |████████████████████████████████| 61kB 3.8MB/s
Requirement already satisfied, skipping upgrade: setuptools in d:\mozilla-build\python3\lib\site-packages (from MozPhab) (41.4.0)
Installing collected packages: MozPhab
  Found existing installation: MozPhab 0.1.72
    Uninstalling MozPhab-0.1.72:
ERROR: Could not install packages due to an EnvironmentError: [WinError 5] アクセスが拒否されました。: 'd:\\mozilla-build\\python3\\scripts\\moz-phab.exe'
Consider using the `--user` option or check the permissions.

CommandError: command 'd:\mozilla-build\python3\python3.exe' failed to complete successfully
Run moz-phab again with '--trace' to show the stack trace

$ moz-phab self-update
Cannot open d:\mozilla-build\python3\Scripts\moz-phab-script.py

$
Flags: needinfo?(VYV03354)
$ pip3 install MozPhab
Collecting MozPhab
  Downloading https://files.pythonhosted.org/packages/17/25/1c0b9c654d9bd623404c5b561a65e255c3beba67c52d6786e7a135523c2b/MozPhab-0.1.73.tar.gz (57kB)
     |████████████████████████████████| 61kB 1.3MB/s
Requirement already satisfied: setuptools in d:\mozilla-build\python3\lib\site-packages (from MozPhab) (41.4.0)
Installing collected packages: MozPhab
    Running setup.py install for MozPhab ... done
Successfully installed MozPhab-0.1.73
WARNING: You are using pip version 19.3; however, version 20.0 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

$

I still get this error everytime I upgrade moz-phab via moz-phab itself. (pip3 install works.)

This one?

$ moz-phab self-update
Cannot open d:\mozilla-build\python3\Scripts\moz-phab-script.py
Flags: needinfo?(VYV03354)

For the first time, I get

ERROR: Could not install packages due to an EnvironmentError: [WinError 5] アクセスが拒否されました。: 'd:\\mozilla-build\\python3\\scripts\\moz-phab.exe'
Consider using the `--user` option or check the permissions.

CommandError: command 'd:\mozilla-build\python3\python3.exe' failed to complete successfully
Run moz-phab again with '--trace' to show the stack trace

This error breaks the existing installation. Therefore, if I rerun the command, I get

Cannot open d:\mozilla-build\python3\Scripts\moz-phab-script.py

until I run pip3 install MozPhab to repair the install.

Flags: needinfo?(VYV03354)

Upgrading to version 0.1.85 succeeded without any errors!

Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: