-
Notifications
You must be signed in to change notification settings - Fork 267
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
Refactored TemporaryFile and GitRepository into context managers. #772
Conversation
9494d47
to
c2bbf2f
Compare
Codecov Report
@@ Coverage Diff @@
## main #772 +/- ##
=======================================
Coverage 91.30% 91.30%
=======================================
Files 75 75
Lines 1990 2002 +12
=======================================
+ Hits 1817 1828 +11
- Misses 173 174 +1
Continue to review full report at Codecov.
|
logging.info(f"Checking out components into {work_dir}") | ||
os.chdir(work_dir) | ||
logging.info(f"Checking out components into {work_dir.name}") | ||
os.chdir(work_dir.name) |
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.
Just curious: do we need this since mkdtemp is removed in the latest commit?
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.
Yes, mkdtemp
was just a class method that called and retured TemporaryDirectory(keep=True/False)
, hence redundant. The object returned is still TemporaryDirectory
that has a method called .name
.
Signed-off-by: dblock <dblock@amazon.com>
Signed-off-by: dblock <dblock@amazon.com>
6c90739
to
d427476
Compare
logging.info(f"Bundling {build.name} ({build.architecture}) on {build.platform} into {output_dir} ...") | ||
|
||
os.chdir(work_dir) | ||
os.chdir(work_dir.name) |
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.
Nit: Just a thought, instead of os.chdir
can we use WorkingDirectory
here and for the rest?
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.
Good point, #775
Description
Refactored TemporaryFile and GitRepository into context managers.
On top of #768, extracted from #767
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.