MCMi460 / NSO-RPC

Connect your Nintendo Switch playing status to Discord!
322 stars 32 forks source link

Cannot build `development` branch due to autoremoved/non-existent version.txt #148

Closed luni-moon closed 4 months ago

luni-moon commented 4 months ago

I tried building the development branch from source, and it failed due to version.txt missing, so I added it as blank manually. I tried again, the file was removed (seemingly due to the code from _version.py, regarding these lines: https://github.com/MCMi460/NSO-RPC/blob/ba58863114907d2b62fbf45e3407d749e4657c4b/client/_version.py#L19-L25

I was not able to get the "stable" version to work, so I did a little poking around and found issues #144 and #146. Then I looked and found that there is a PR, but not before trying a build that HotaruBlaze made about a week ago (which only errored out). This does not seem like an upstream error, so much help would be appreciated, as I wanted to use this while the fixes for the version entering (and probably more) was being worked on. Thank you!

Here is my log output:

PS C:\Users\Luni\Downloads\NSO-RPC-development\NSO-RPC-development\scripts> .\build.bat
Building with PyQt6

[notice] A new release of pip available: 22.2.1 -> 24.0
[notice] To update, run: python.exe -m pip install --upgrade pip
Traceback (most recent call last):
  File "C:\Users\Luni\Downloads\NSO-RPC-development\NSO-RPC-development\client\_version.py", line 23, in <module>
    version_info = get_version_info()
  File "C:\Users\Luni\Downloads\NSO-RPC-development\NSO-RPC-development\client\_version.py", line 6, in get_version_info
    r = git.repo.Repo(search_parent_directories=True)
  File "C:\Users\Luni\AppData\Local\Programs\Python\Python310\lib\site-packages\git\repo\base.py", line 265, in __init__
    raise InvalidGitRepositoryError(epath)
git.exc.InvalidGitRepositoryError: C:\Users\Luni\Downloads\NSO-RPC-development\NSO-RPC-development\client
529 INFO: PyInstaller: 6.3.0
529 INFO: Python: 3.10.6
536 INFO: Platform: Windows-10-10.0.19045-SP0
537 INFO: wrote C:\Users\Luni\Downloads\NSO-RPC-development\NSO-RPC-development\client\NSO-RPC.spec
540 INFO: Removing temporary files and cleaning cache in C:\Users\Luni\AppData\Local\pyinstaller
543 INFO: Extending PYTHONPATH with paths
['C:\\Users\\Luni\\Downloads\\NSO-RPC-development\\NSO-RPC-development\\client']
914 INFO: Appending 'datas' from .spec
Unable to find 'C:\\Users\\Luni\\Downloads\\NSO-RPC-development\\NSO-RPC-development\\client\\version.txt' when adding binary and data files.
PS C:\Users\Luni\Downloads\NSO-RPC-development\NSO-RPC-development\scripts>
HotaruBlaze commented 4 months ago

I updated that code recently to fix some other issue, however I believe your real issue is below.

git.exc.InvalidGitRepositoryError: C:\Users\Luni\Downloads\NSO-RPC-development\NSO-RPC-development\client

This makes me think that you are running it from a zip you downloaded and not a git clone, this will not generate a working _version.txt file, as it uses git history to generate the correct tag/commit

You can either disable the _version.py script and put your own string in for testing, or make sure you are doing a git clone and not a zip download.

git clone -b development https://github.com/MCMi460/NSO-RPC.git


version.txt is just a text string that gets embedded into the app for easier debugging.

image

luni-moon commented 4 months ago

I updated that code recently to fix some other issue, however I believe your real issue is below.

git.exc.InvalidGitRepositoryError: C:\Users\Luni\Downloads\NSO-RPC-development\NSO-RPC-development\client

This makes me think that you are running it from a zip you downloaded and not a git clone, this will not generate a working _version.txt file, as it uses git history to generate the correct tag/commit

You can either disable the _version.py script and put your own string in for testing, or make sure you are doing a git clone and not a zip download.

git clone -b development https://github.com/MCMi460/NSO-RPC.git

version.txt is just a text string that gets embedded into the app for easier debugging.

image

Ah, thank you. I prefer not to do cloning (as I don't like GitHub and MSFT security stuff, nut this is better than GitLab), so that's why I do zip downloads. I'll try the aforementioned way and see if that works.

Edit: I got it to work after commentiong out everything in the _version.py and typing in keyboard mash into a newly created version.txt and built it. It is working beautifully now (until the next break comes). Thanks again!

HotaruBlaze commented 4 months ago

https://github.com/MCMi460/NSO-RPC/blob/ba58863114907d2b62fbf45e3407d749e4657c4b/scripts/build.bat#L35-L36

May be smarter to just comment out the build step above :)

luni-moon commented 4 months ago

https://github.com/MCMi460/NSO-RPC/blob/ba58863114907d2b62fbf45e3407d749e4657c4b/scripts/build.bat#L35-L36

May be smarter to just comment out the build step above :)

I couldn't find it for the life of me, but it displays RPC either way, so I guess for once programming fixes two bugs with one line(?) Okay, a bad idiom made modern...