Francesco149 / oppai-ng

difficulty and pp calculator for osu!. better, smaller, faster rewrite of https://github.com/Francesco149/oppai
The Unlicense
155 stars 36 forks source link

windows pip install oppai version == INVALID #49

Closed Syriiin closed 5 years ago

Syriiin commented 5 years ago

As title suggests, when installing the python bindings on windows via pip, the setup.py will fail to from oppai import oppai_version_str and hit the fallback "INVALID" version string.

Appears to only affect the package name and pip version data (package name is "oppai-INVALID" and pip freeze displays oppai===INVALID). The actual package works as intended with the internal version displaying the correct "3.2.0". This will be a problem though if people use pip freeze > requirements.txt to generate their requirements file as it will cause pip to throw an error when installing from it (unless they manually edit out the version string).

As a side note for anyone running into errors relating to C++ build tools or missing .h files when attempting the pip install, make sure you have the latest C++ build tools installed from https://visualstudio.microsoft.com/downloads. For some odd reason my win7 pc required me to install the latest VS2019 C++ build tools, but my win10 pc required the VS2017 C++ build tools.

Francesco149 commented 5 years ago

this kind of a chicken and egg problem, it requires the oppai dll to be already built to be able to build the pip package. if you build it again it should get the correct version. it's kind of a messy workaround to not have to update the version in multiple places. the linux binaries i uploaded to pip for example should show the correct version

Syriiin commented 5 years ago

but it doesn't happen on linux. is there a different build order or something?

Francesco149 commented 5 years ago

on linux you aren't compiling it on the spot because I already uploaded binaries to pip which I built using that bootstrapping step of building it twice (here's the script that does it, it does build_ext first as you can see https://github.com/Francesco149/oppai-ng/blob/master/swig/python/build_wheels.sh). I didnt bother making windows binaries though

Syriiin commented 5 years ago

ah, makes sense. almost feel like it would be worth to do some messy regex to pull the version numbers out of the oppai.c source since even though its still not a good solution, it atleast works on anywhere the setup.py will run and don't need to worry about the extra step for the linux binaries

Francesco149 commented 5 years ago

yeah i was thinking of that too, will prob do that

Francesco149 commented 5 years ago

i set up appveyor to automatically build and upload windows wheels, so future releases will not even require msvc on windows

Syriiin commented 5 years ago

oh neato