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

Migrate to use Buildop's rmtree, file_copy, file_copytree and rename #1669

Merged
merged 2 commits into from
Aug 26, 2023

Conversation

Julian-O
Copy link
Contributor

This is part of a bigger refactor to reduce the size and complexity of the Buildozer class. It adds no new functionality (apart from making logging more consistent)

  • Remove file_rename, file_copy and file_copytree from Buildozer.
  • Update all references to those Buildozer methods to refer to buildops equivalents.
    • Note: file_rename is now called rename as, in practice, it was also used to rename directories.
  • Updated all references to shutil.copyfile and shutil.rmtree to use the Buildops equivalents
    • Note this adds implicit debug logging, making them more consistent.
  • Updated all references to check_call() and check_output() that called the rm and cp shell commands.
    • Note this adds implicit debug logging, making them more consistent, and improves performance.
  • Updated mock in test.

Cheekily, also removed some obsolete references to Python 2 (only) standard libraries to make my IDE stop warning me about them while I edited the file.

This is part of a bigger refactor to reduce the size and complexity of the Buildozer class. It adds no new functionality (apart from making logging more consistent)

* Remove file_rename, file_copy and file_copytree from Buildozer.
* Update all references to those Buildozer methods to refer to buildops equivalents.
   * Note: `file_rename` is now called rename as, in practice, it was also used to rename directories.
* Updated all references to shutil.copyfile and shutil.rmtree to use the Buildops equivalents
  * Note this adds implicit debug logging, making them more consistent.
* Updated all references to check_call() and check_output() that called the `rm` and `cp` shell commands.
  * Note this adds implicit debug logging, making them more consistent, and improves performance.
* Updated mock in test.

Cheekily, also removed some obsolete references to Python 2 (only) standard libraries to make my IDE stop warning me about them while I edited the file.
Copy link
Member

@misl6 misl6 left a comment

Choose a reason for hiding this comment

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

From a quick check, I've found (and added a comment) one reference of file_rename which needs to be migrated, can you take care of it?

@@ -476,23 +476,6 @@ def file_matches(self, patterns):
def file_exists(self, *args):
return exists(join(*args))

def file_rename(self, source, target, cwd=None):
Copy link
Member

Choose a reason for hiding this comment

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

Seems we still have a reference to file_rename here:

self.buildozer.file_rename(ipa_tmp, ipa)

@Julian-O
Copy link
Contributor Author

@misl6:

Good spot. I do remember seeing the log message directly above it ('Moving IPA to bin...' sounds like it is throwing away some beer) so I don't know how I missed this one. Fixed.

[I also accidentally gave a sneak preview of the next PR by committing in the wrong branch. I've undone that too.]

@misl6
Copy link
Member

misl6 commented Aug 26, 2023

('Moving IPA to bin...' sounds like it is throwing away some beer)

😂

Copy link
Member

@misl6 misl6 left a comment

Choose a reason for hiding this comment

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

LGTM. Thank you!

@misl6 misl6 merged commit 722f440 into kivy:master Aug 26, 2023
14 checks passed
@Julian-O Julian-O deleted the buildopsrenamecopy branch August 26, 2023 08:26
misl6 added a commit to misl6/buildozer that referenced this pull request Aug 27, 2023
misl6 added a commit that referenced this pull request Aug 27, 2023
aorizondo pushed a commit to aorizondo/buildozer that referenced this pull request Aug 28, 2023
…ivy#1669)

* Migrate to use Buildop's rmtree, file_copy, file_copytree and rename

This is part of a bigger refactor to reduce the size and complexity of the Buildozer class. It adds no new functionality (apart from making logging more consistent)

* Remove file_rename, file_copy and file_copytree from Buildozer.
* Update all references to those Buildozer methods to refer to buildops equivalents.
   * Note: `file_rename` is now called rename as, in practice, it was also used to rename directories.
* Updated all references to shutil.copyfile and shutil.rmtree to use the Buildops equivalents
  * Note this adds implicit debug logging, making them more consistent.
* Updated all references to check_call() and check_output() that called the `rm` and `cp` shell commands.
  * Note this adds implicit debug logging, making them more consistent, and improves performance.
* Updated mock in test.

Cheekily, also removed some obsolete references to Python 2 (only) standard libraries to make my IDE stop warning me about them while I edited the file.

* Fixed missed file_rename reference in IOS
aorizondo pushed a commit to aorizondo/buildozer that referenced this pull request Aug 28, 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