Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
luni-moon opened this issue May 15, 2024 · 4 comments
Closed

Comments

@luni-moon
Copy link

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:

if __name__ == '__main__':
if os.path.exists('version.txt'):
os.remove('version.txt')
version_info = get_version_info()
with open('version.txt', 'w') as f:
f.write(version_info)

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
Copy link
Contributor

HotaruBlaze commented May 15, 2024

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
Copy link
Author

luni-moon commented May 15, 2024

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
Copy link
Contributor

REM Generate version.txt
python _version.py

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

@luni-moon
Copy link
Author

REM Generate version.txt
python _version.py

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...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants