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

Support for multiple "from"-fields with the same value. #12

Merged
merged 6 commits into from
Aug 29, 2016
Merged

Support for multiple "from"-fields with the same value. #12

merged 6 commits into from
Aug 29, 2016

Conversation

bioxz
Copy link
Contributor

@bioxz bioxz commented Aug 28, 2016

The release of Factorio 0.14.0 added two update possibilities for 0.13.18: 0.13.18 to 0.13.19 and 0.13.18 to 0.14.0. This commit supports that change by respecting the experimental flag earlier. Due to those changes, some declarations are moved to the top of the function and some comments have been added.

The release of Factorio 0.14.0 added two update possibilities for 0.13.18: 0.13.18 to 0.13.19 and 0.13.18 to 0.14.0. This commit supports that change by respecting the experimental flag earlier. Due to those changes, some declarations are moved to the top of the function and some comments have been added.
updates = []
# Get available updates
for row in updater_json[factorio_package]:
if not experimental and 'from' in row and row['from'] >= current_version and row['to'] <= latest[0]:
Copy link
Owner

@narc0tiq narc0tiq Aug 29, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, it's been a fair while since I wrote this originally, but I'm pretty sure comparing versions as strings doesn't work correctly ("0.13.2" compares as > "0.13.10"); this is why the version_key function (stolen from elsewhere, IIRC) exists and breaks the string into a list of ints (which does compare as expected).

Otherwise, I believe this does as expected, so fix the version comparison and I'll go ahead and merge it.

@narc0tiq
Copy link
Owner

Thanks for the assist, I really appreciate it.

@bioxz
Copy link
Contributor Author

bioxz commented Aug 29, 2016

Thanks for the hint, you where right. An update from 0.13.5 would not have worked with my code. I used the mentioned function and now it seems to be working for all versions (i have tested 0.12.13, 0.13.0, 0.13.5, 0.13.15, 0.13.18 to stable and experimental).

The only thing that is not working is to update from 0.13.19 (the latest stable) to experimental, but that's the "fault" of the Factorio developers, as there is no update package for 0.13.19 to experimental because 0.13.19 got released after the new experimental branch.

I deleted the updates.append line somehow, that's also fixed now.

@bioxz
Copy link
Contributor Author

bioxz commented Aug 29, 2016

Seems like i also removed the return value latest[1] by accident, which is used later to show the latest experimental version. I've added some lines to get that value.

@narc0tiq
Copy link
Owner

Looks good to me, let me get this merged.

@narc0tiq narc0tiq merged commit cd055f3 into narc0tiq:master Aug 29, 2016
narc0tiq added a commit that referenced this pull request Aug 29, 2016
Factorio 0.13.18 can update to .19 or to .14.0, the latter of which is
not stable; therefore, stable update should only fetch the former.

Closes #11, thanks @bioxz!
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

Successfully merging this pull request may close these issues.

2 participants