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

Update Craft Addon #2113

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open

Update Craft Addon #2113

wants to merge 2 commits into from

Conversation

Snapster-amb
Copy link
Contributor

What

  • Updated slpp.py and create_recipes.py to python 3
  • Ran create_recipes.py to build the latest recipe set

Why?

There were some missing recipes and the script for generating
new recipes by pulling data from bg-wiki was not working on python3.

What
====

- Updated slpp.py and create_recipes.py to python 3
- Ran create_recipes.py to build the latest recipe set

Why?
====

There were some missing recipes and the script for generating
new recipes by pulling data from bg-wiki was not working on python3.
@RubenatorX
Copy link
Collaborator

Unless py2 can run that, I'd probably prefer if we also kept a py2 version so we can pick

Copy link
Member

@z16 z16 left a comment

Choose a reason for hiding this comment

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

I don't mind it being Python 3 only. I don't think any of the 0.7 people using this have any trouble installing Python 3, if they don't have it already. Just curious about the import and the default path. I assume this was chosen because that's the default path chosen by the new installer? Though that in itself also bothers me a bit, I'll have a talk with the team about this.

addons/craft/create_recipes.py Show resolved Hide resolved
@@ -118,10 +121,10 @@ def get_recipes_from_soup(soup, spheres=False):

def get_items_dictionary():
if platform.system() == 'Windows':
path = 'C:\\Program Files (x86)\\Windower4\\res\\items.lua'
path = 'C:/Program Files (x86)/Windower/res/items.lua'
Copy link
Member

Choose a reason for hiding this comment

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

This really bothers me, but it bothered me before your change as well. Why is this hard coded instead of using a relative path, or alternatively a path passed in via the command line (or both, with the relative path being a fallback)?

Also, backwards slashes are correcterer.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The reason is mostly laziness. The python scripts are things that a developer or user might periodically run to update the recipes and create a pull request, so much less thought was put into these kings of details.

Copy link
Member

Choose a reason for hiding this comment

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

Considering most people will run this script from their Windower installation I'd just make it relative. This path would break for me, for example, as well as for many people who followed the common advice we gave of where to install Windower to until recently. That falls well within the limits of laziness imo :)

Ideally we'd have another mechanism for specifying the path, but those are obviously more work and would exceed the purpose of the PR, especially since this is nothing the PR changed.

@@ -204,10 +208,10 @@ def build_recipe_string(name, crystal, ingredients):

def save_recipes(recipes):
with open('recipes.lua', 'w') as fd:
Copy link
Member

Choose a reason for hiding this comment

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

Would this (and other) open functions benefit from the encoding parameter? You added to to the file you're reading from, but I'm not sure what exactly we're writing here. Can non-ASCII characters appear, like Japanese text?

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.

None yet

3 participants