Update code in accordance to the Python 3.11

This commit is contained in:
Ivan Kravets
2023-07-31 19:10:05 +03:00
parent 527e7f16f6
commit c9b3e4ed65

View File

@ -29,15 +29,16 @@ from platformio.compat import IS_WINDOWS
class cd:
def __init__(self, new_path):
self.new_path = new_path
self.prev_path = os.getcwd()
def __init__(self, path):
self.path = path
self._old_cwd = []
def __enter__(self):
os.chdir(self.new_path)
self._old_cwd.append(os.getcwd())
os.chdir(self.path)
def __exit__(self, etype, value, traceback):
os.chdir(self.prev_path)
def __exit__(self, *excinfo):
os.chdir(self._old_cwd.pop())
def get_source_dir():