fix: inconsistent usage of dirs separator

This commit is contained in:
Massimiliano Montagni
2023-05-25 11:16:11 +02:00
parent 37efb1d96f
commit f558f22974
4 changed files with 9 additions and 9 deletions

View File

@@ -97,13 +97,13 @@ DEFAULT_CONNECT_ATTEMPTS = cfg.getint("connect_attempts", 7)
# Number of times to try writing a data block
WRITE_BLOCK_ATTEMPTS = cfg.getint("write_block_attempts", 3)
STUBS_DIR = os.path.join(os.path.dirname(__file__), "./targets/stub_flasher/")
STUBS_DIR = os.path.join(os.path.dirname(__file__), "targets", "stub_flasher")
def get_stub_json_path(chip_name):
chip_name = strip_chip_name(chip_name)
chip_name = chip_name.replace("esp", "")
return STUBS_DIR + "stub_flasher_" + chip_name + ".json"
return os.path.join(STUBS_DIR, f"stub_flasher_{chip_name}.json")
def timeout_per_mb(seconds_per_mb, size_bytes):

View File

@@ -17,7 +17,7 @@ sys.path.append("..")
import esptool # noqa: E402
THIS_DIR = os.path.dirname(__file__)
BUILD_DIR = os.path.join(THIS_DIR, "./build/")
BUILD_DIR = os.path.join(THIS_DIR, "build")
def wrap_stub(elf_file):
@@ -66,7 +66,7 @@ def write_json_files(stubs_dict):
return json.JSONEncoder.default(self, obj)
for filename, stub_data in stubs_dict.items():
with open(BUILD_DIR + filename, "w") as outfile:
with open(os.path.join(BUILD_DIR, filename), "w") as outfile:
json.dump(stub_data, outfile, cls=BytesEncoder, indent=4)

View File

@@ -36,9 +36,9 @@ from bitstring import BitStream
from conftest import arg_chip, arg_port, arg_reset_port, need_to_install_package_err
TEST_DIR = os.path.abspath(os.path.dirname(__file__))
IMAGES_DIR = os.path.join(TEST_DIR, "images/efuse/")
S_IMAGES_DIR = os.path.join(TEST_DIR, "secure_images/")
EFUSE_S_DIR = os.path.join(TEST_DIR, "efuse_scripts/")
IMAGES_DIR = os.path.join(TEST_DIR, "images", "efuse")
S_IMAGES_DIR = os.path.join(TEST_DIR, "secure_images")
EFUSE_S_DIR = os.path.join(TEST_DIR, "efuse_scripts")
import pytest

View File

@@ -12,7 +12,7 @@ try:
except ImportError:
need_to_install_package_err()
IMAGES_DIR = os.path.join(os.path.abspath(os.path.dirname(__file__)), "images/")
IMAGES_DIR = os.path.join(os.path.abspath(os.path.dirname(__file__)), "images")
ESP8266_BIN = "not_4_byte_aligned.bin"
@@ -40,7 +40,7 @@ class TestImageInfo:
]
if version is not None:
cmd += ["--version", str(version)]
cmd += ["".join([IMAGES_DIR, file])]
cmd += ["".join([IMAGES_DIR, os.sep, file])]
print("\nExecuting {}".format(" ".join(cmd)))
try: