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

g.extension: use copytree from shutil for py >= 3.8 #2592

Merged
merged 1 commit into from
Oct 2, 2022

Conversation

ninsbl
Copy link
Member

@ninsbl ninsbl commented Oct 2, 2022

Here is a suggestion to address #2016
Not sure if it needs to be backported all the way to 7.8 as people with such an old installation, probably do not have more recent Python anyway. So maybe 8.0 is a sufficient milestone.

An alternative implementation would be choose the function later in the code, like:

if sys.version_info.major == 3 and sys.version_info.minor < 8:
        from distutils.dir_util import copy_tree

And then here:

copy_tree(actual_file, os.path.join(target_dir, file_name))

if sys.version_info.major == 3 and sys.version_info.minor < 8:
    copy_tree(actual_file, os.path.join(target_dir, file_name))
else:
    shutil.copytree(actual_file, os.path.join(target_dir, file_name), dirs_exist_ok=True)

@ninsbl ninsbl added the bug Something isn't working label Oct 2, 2022
@ninsbl ninsbl added this to the 7.8.9 milestone Oct 2, 2022
@ninsbl ninsbl requested a review from petrasovaa October 2, 2022 19:07
Copy link
Contributor

@petrasovaa petrasovaa left a comment

Choose a reason for hiding this comment

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

Didn't test, but looks good! I would say 8 is sufficient.

@ninsbl ninsbl merged commit 9b467ce into OSGeo:main Oct 2, 2022
@ninsbl
Copy link
Member Author

ninsbl commented Oct 2, 2022

Backported to 8.0 in 20bee01
and 8.2 in c780325

@ninsbl ninsbl modified the milestones: 7.8.9, 8.0.3 Oct 2, 2022
ninsbl added a commit to ninsbl/grass that referenced this pull request Oct 26, 2022
@ninsbl ninsbl deleted the g_extension_distutils branch October 26, 2022 07:38
ninsbl added a commit to ninsbl/grass that referenced this pull request Feb 17, 2023
marisn pushed a commit to marisn/grass that referenced this pull request Jun 2, 2023
neteler pushed a commit to nilason/grass that referenced this pull request Nov 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants