cctbx / dxtbx

Diffraction Experiment Toolbox
BSD 3-Clause "New" or "Revised" License
2 stars 18 forks source link

dxtbx.install_format -u problem on Windows #304

Open dagewa opened 3 years ago

dagewa commented 3 years ago

dxtbx.install_format -u does not work on a Windows user installation, because it relies on creating the package name dxtbx_custom as a symlink to %USERPROFILE%\.dxtbx. On Windows without developer mode, this fails as follows:

C:\Users\fcx32934\sw\cctbx\modules\dxtbx>dxtbx.install_format -u https://raw.githubusercontent.com/dials/dxtbx_ED_formats/master/FormatMRC.py
Downloaded https://raw.githubusercontent.com/dials/dxtbx_ED_formats/master/FormatMRC.py to C:\Users\fcx32934\.dxtbx\FormatMRC.py
  found FormatMRC based on ['Format']
  found FormatMRCimages based on ['FormatMRC']
  found FormatMRCstack based on ['FormatMultiImage', 'FormatMRC']
Traceback (most recent call last):
  File "C:\Users\fcx32934\sw\cctbx\build\..\modules\dxtbx\command_line\install_format.py", line 161, in <module>
    run()
  File "C:\Users\fcx32934\sw\cctbx\build\..\modules\dxtbx\command_line\install_format.py", line 156, in run
    install_package(home_location, format_classes)
  File "C:\Users\fcx32934\sw\cctbx\build\..\modules\dxtbx\command_line\install_format.py", line 74, in install_package
    (home_location / "dxtbx_custom").mksymlinkto(home_location)
AttributeError: 'LocalPath' object has no attribute 'mksymlinkto'
dagewa commented 3 years ago

I'm not sure developer mode would help, as it seems mksymlinkto is simply missing, not just that it fails.

dagewa commented 3 years ago

It seems py is deprecated and instead of py.path, we should be using pathlib instead. In that case, Path.symlink_to could be used, but that fails for user installations where developer mode is not enabled

OSError: [WinError 1314] A required privilege is not held by the client: 'C:\\Users\\fcx32934\\.dxtbx\\FormatMRC.py' -> 'C:\\Users\\fcx32934\\.dxtbx\\test'
dagewa commented 3 years ago

I just noticed that -g does not work either, for the same reason