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

iterate through sys.path instead of just checking cwd #1985

Merged
merged 1 commit into from
Aug 24, 2023

Conversation

jprokos26
Copy link
Contributor

Makes it so you can put patch_base_images for carla od adv patch in any folder added to local_repo_dir in config.

@jprokos26 jprokos26 requested a review from swsuggs August 22, 2023 03:16
@@ -57,11 +58,18 @@ def create_initial_image(self, size, hsv_lower_bound, hsv_upper_bound):
patch_base_image_path = os.path.abspath(
os.path.join(module_folder, self.patch_base_image)
)
# if the image does not exist, check cwd
# if the image does not exist iterate through path
if not os.path.exists(patch_base_image_path):
Copy link
Contributor

Choose a reason for hiding this comment

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

Would it make sense to combine this conditional (line 62) with the similar one on line 74?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This can certainly be cleaned up to avoid fallthroughs like this but the second check on 74 is needed to determine if it was in the path. Another option is to use for-break iterating through the path and checking for url only if the loop finishes.

Regardless, I am cleaning this code path up in #1904:
bff3f02#diff-43528b7021f0d40c4760148beb2bdbb8e81013288e0d00e42ff57940600b7d12R124-R167

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I created this PR more as a hotfix so people can use images anywhere off their armory git directory by including it in the local_repo_path since that gets added to your pythonpath. Happy to move the fetch_file_or_url function into this PR to prevent additional changes with #1904

Copy link
Contributor

Choose a reason for hiding this comment

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

Got it. Fine either way

@jprokos26 jprokos26 merged commit 7c19275 into twosixlabs:develop Aug 24, 2023
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