jborean93 / pyspnego

Python SPNEGO authentication library
MIT License
52 stars 11 forks source link

Wheel for Windows does not install properly #9

Closed Franky1 closed 3 years ago

Franky1 commented 3 years ago

Tried to install with pip install -U pyspnego

However the pyspnego-parse command was not found and not executable. I found a file in the Python scripts folder without any file extension named pyspnego-parse


Then i looked into the wheel file. Downloaded pyspnego-0.1.5-cp38-cp38-win_amd64.whl from pypi. Renamed it to .zip and unzipped the file. Found the following file structure by running tree /F There is also the file pyspnego-parse without any file extension.

│   
├───pyspnego-0.1.5.data
│   └───scripts
│           pyspnego-parse
│           
├───pyspnego-0.1.5.dist-info
│       LICENSE
│       METADATA
│       RECORD
│       top_level.txt
│       WHEEL
│       
└───spnego
    │   auth.py
    │   channel_bindings.py
    │   exceptions.py
    │   gss.py
    │   iov.py
    │   negotiate.py
    │   ntlm.py
    │   sspi.py
    │   _asn1.py
    │   _compat.py
    │   _context.py
    │   _kerberos.py
    │   _spnego.py
    │   _text.py
    │   _version.py
    │   __init__.py
    │   
    ├───_ntlm_raw
    │       crypto.py
    │       des.py
    │       messages.py
    │       security.py
    │       __init__.py
    │       
    └───_sspi_raw
            security.pxd
            sspi.c
            sspi.cp38-win_amd64.pyd
            sspi.pxd
            sspi.pyx
            text.c
            text.cp38-win_amd64.pyd
            text.pxd
            text.pyx
            windows.pxd
            __init__.py
Franky1 commented 3 years ago

On Linux it works and there the same file is installed in:

/usr/local/bin/pyspnego-parse

I assume, Windows does not know how to handle this file without extension and/or does not understand the first line:

#!/usr/bin/python3
jborean93 commented 3 years ago

Yea unfortunately without the extension Windows has no idea how to execute the Python script, shebangs aren't a thing there. I'm not sure how it would be possible to include both the extension and non-extension in the package, maybe I just need a symlink to have both files.

Franky1 commented 3 years ago

I am not an python packaging expert, but what about renaming to pyspnego-parse.py This should work on all platforms?

jborean93 commented 3 years ago

It would but it would also be a breaking change, potentially we could have both or even just document doing python -m pyspnego ... instead.

Franky1 commented 3 years ago

Yes I also think it would be sufficient to simply add to the documentation regarding this to avoid future confusion from Windows users.

jborean93 commented 3 years ago

I believe https://github.com/jborean93/pyspnego/pull/12 should give a universal way to run this code. It allows you to do python -m spnego --token .... on both Linux and Windows. I decided against adding another entrypoint for pyspnego-parse.py in favour of using this more generic method. Using pyspnego-parse will still work on Linux but I'm going to remove references to that in the doc.