KBNLresearch / iromlab

Loader software for automated imaging of optical media with Nimbie disc robot
Apache License 2.0
31 stars 5 forks source link

Iromlab-configure creates shortcut to wrong location in case of user install #92

Closed bitsgalore closed 5 years ago

bitsgalore commented 5 years ago

Steps to reproduce:

Install as user using:

python -m pip install --user iromlab

This installs Iromlab to the Scripts and site-packages directories under

C:\Users\jkn010\AppData\Roaming\Python\Python36

Run config:

C:\Users\jkn010\AppData\Roaming\Python\Python36\Scripts\iromlab-configure

This creates a Windows shortcut with target C:\python36\Scripts\iromlab.exe and start location C:\python36\Scripts. This should be C:\Users\jkn010\AppData\Roaming\Python\Python36\Scripts\iromlab.exe and C:\Users\jkn010\AppData\Roaming\Python\Python36\Scripts, respectively.

bitsgalore commented 5 years ago

Behaviour is caused by this line in configure.pyw:

 scriptsDir = sysconfig.get_path('scripts')

From the docs:

nt: scheme for NT platforms like Windows. nt_user: scheme for NT platforms, when the user option is used.

So it seems get_path assumes the nt scheme, whereas we really need nt_user in this case. A simple fix is this:

scriptsDir = sysconfig.get_path('scripts', 'nt_user')

BUT this goes wrong if iromlab was not installed as user. So the question is: how to check whether iromlab was installed as user or not?

bitsgalore commented 5 years ago

Fixed by getting ScriptsDir as path to config tool binary: https://github.com/KBNLresearch/iromlab/commit/b57dc5ff531d3d68e1ac860b03f09b3fac481fa1