-
Notifications
You must be signed in to change notification settings - Fork 444
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
Fix pybabel update --init-missing
not creating parent directory
#1142
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we get some sort of test for this? Does the (re)use of InitCatalog
do exactly the same thing as the old code?
@@ -626,8 +626,8 @@ def finalize_options(self): | |||
self.output_file = os.path.join(self.output_dir, self.locale, | |||
'LC_MESSAGES', f"{self.domain}.po") | |||
|
|||
if not os.path.exists(os.path.dirname(self.output_file)): | |||
os.makedirs(os.path.dirname(self.output_file)) | |||
os.makedirs(os.path.dirname(self.output_file),exist_ok=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
os.makedirs(os.path.dirname(self.output_file),exist_ok=True) | |
os.makedirs(os.path.dirname(self.output_file), exist_ok=True) |
tmpInitCatalog = InitCatalog(self.distribution) | ||
tmpInitCatalog.output_dir = None | ||
tmpInitCatalog.output_file = filename | ||
tmpInitCatalog.input_file = self.input_file | ||
tmpInitCatalog.locale = self.locale | ||
tmpInitCatalog.domain = self.domain | ||
tmpInitCatalog.no_wrap = self.no_wrap | ||
tmpInitCatalog.width = self.width | ||
tmpInitCatalog.finalize_options() | ||
tmpInitCatalog.run() | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Variable names should be in snake_case
, not camelCase
.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #1142 +/- ##
=======================================
Coverage 91.28% 91.28%
=======================================
Files 27 27
Lines 4623 4624 +1
=======================================
+ Hits 4220 4221 +1
Misses 403 403
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Replaced the redundant init logic in
UpdateCatalog.run()
with a temporaryInitCatalog
instance to ensure the parent directory of the output file will be created. (close #1139)