Skip to content

Commit

Permalink
fix(tools): python3.12 support
Browse files Browse the repository at this point in the history
remove distutils use
  • Loading branch information
nim65s committed Sep 4, 2024
1 parent d7ca8b9 commit 727c6a8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
15 changes: 8 additions & 7 deletions tools/idf_py_actions/create_ext.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
# SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
# SPDX-License-Identifier: Apache-2.0
from __future__ import print_function

import os
import re
import sys
from distutils.dir_util import copy_tree
from shutil import copy
from shutil import copytree
from typing import Dict

import click
Expand Down Expand Up @@ -40,10 +39,11 @@ def is_empty_and_create(path: str, action: str) -> None:


def create_project(target_path: str, name: str) -> None:
copy_tree(
copytree(
os.path.join(os.environ['IDF_PATH'], 'examples', 'get-started', 'sample_project'),
target_path,
preserve_mode=0,
copy_function=copy,
dirs_exist_ok=True,
)
main_folder = os.path.join(target_path, 'main')
os.rename(os.path.join(main_folder, 'main.c'), os.path.join(main_folder, '.'.join((name, 'c'))))
Expand All @@ -53,10 +53,11 @@ def create_project(target_path: str, name: str) -> None:


def create_component(target_path: str, name: str) -> None:
copy_tree(
copytree(
os.path.join(os.environ['IDF_PATH'], 'tools', 'templates', 'sample_component'),
target_path,
preserve_mode=0,
copy_function=copy,
dirs_exist_ok=True,
)
os.rename(os.path.join(target_path, 'main.c'), os.path.join(target_path, '.'.join((name, 'c'))))
os.rename(os.path.join(target_path, 'include', 'main.h'),
Expand Down
4 changes: 2 additions & 2 deletions tools/mass_mfg/mfg_gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
import csv
import os
from itertools import zip_longest
from pathlib import Path

import distutils.dir_util
import esp_idf_nvs_partition_gen.nvs_partition_gen as nvs_partition_gen


Expand Down Expand Up @@ -208,7 +208,7 @@ def create_dir(filetype, output_dir_path):
"""
output_target_dir = os.path.join(output_dir_path,filetype,'')
if not os.path.isdir(output_target_dir):
distutils.dir_util.mkpath(output_target_dir)
Path(output_target_dir).mkdir(parents=True)

return output_target_dir

Expand Down

0 comments on commit 727c6a8

Please sign in to comment.