|
|
@@ -82,20 +82,24 @@ class PlatformioBuilder(object):
|
|
|
shutil.copy(self.long_path_enable(src_item_path), self.long_path_enable(dst_item_path))
|
|
|
|
|
|
def copy_platformio_packages(self):
|
|
|
- print("************* Copy and install platformio packages (Step 1/2) ***************")
|
|
|
+ print("************* Copy and install platformio packages (Step 1/2) ***************", flush=True)
|
|
|
if not self.platformio_path.exists():
|
|
|
os.makedirs(self.long_path_enable(self.platformio_path))
|
|
|
+ print("Copying .platformio folder...", flush=True)
|
|
|
self.cp_fr_list([".platformio"], self.current_folder, self.home_path)
|
|
|
else:
|
|
|
+ print("Copying packages...", flush=True)
|
|
|
self.cp_fr_list(os.listdir(self.current_folder.joinpath(".platformio/packages")),
|
|
|
self.current_folder.joinpath(".platformio/packages"),
|
|
|
self.platformio_path.joinpath("packages"))
|
|
|
+ print("Copying platforms...", flush=True)
|
|
|
self.cp_fr_list(os.listdir(self.current_folder.joinpath(".platformio/platforms")),
|
|
|
self.current_folder.joinpath(".platformio/platforms"),
|
|
|
self.platformio_path.joinpath("platforms"))
|
|
|
other_file_and_folders = os.listdir(self.current_folder.joinpath(".platformio"))
|
|
|
other_file_and_folders.remove("platforms")
|
|
|
other_file_and_folders.remove("packages")
|
|
|
+ print("Copying other files...", flush=True)
|
|
|
self.cp_fr_list(other_file_and_folders, self.current_folder.joinpath(".platformio"), self.platformio_path)
|
|
|
if self.platformio_path.joinpath("penv").exists():
|
|
|
if Path.is_dir(self.platformio_path.joinpath("penv")):
|
|
|
@@ -104,12 +108,13 @@ class PlatformioBuilder(object):
|
|
|
os.remove(self.long_path_enable(self.platformio_path.joinpath("penv")))
|
|
|
|
|
|
def copy_portble_python(self):
|
|
|
+ print("Copying python environment...", flush=True)
|
|
|
self.cp_fr_list(['python377x64'], self.current_folder, self.platformio_path.joinpath(".rt_studio"))
|
|
|
|
|
|
def install_platformio(self):
|
|
|
- print("************* Create platformio environment (Step 2/2) ***************")
|
|
|
+ print("************* Create platformio environment (Step 2/2) ***************", flush=True)
|
|
|
os.system(str(self.python_path.as_posix()) + " " + str(self.get_platformio_script_path.as_posix()))
|
|
|
- print("************* Done ***************")
|
|
|
+ print("************* Done ***************", flush=True)
|
|
|
|
|
|
def make_platformio(self):
|
|
|
self.copy_platformio_packages()
|
|
|
@@ -124,27 +129,27 @@ if len(sys.argv) > 2:
|
|
|
is_studio_global_version = True
|
|
|
else:
|
|
|
is_studio_global_version = False
|
|
|
- print("rt_studio_version: " + str(rt_studio_version))
|
|
|
+ print("rt_studio_version: " + str(rt_studio_version), flush=True)
|
|
|
if rt_studio_version >= "2.0.0":
|
|
|
if int(platform.release()) >= int("10"):
|
|
|
result = os.popen(
|
|
|
"""reg query HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\FileSystem /v LongPathsEnabled""")
|
|
|
if "1" in result.read().strip().split(" ")[-1]:
|
|
|
- print("Long path support has enabled")
|
|
|
+ print("Long path support has enabled", flush=True)
|
|
|
else:
|
|
|
- print("Long path support has not enabled")
|
|
|
- print("Enable windows long path support...")
|
|
|
+ print("Long path support has not enabled", flush=True)
|
|
|
+ print("Enable windows long path support...", flush=True)
|
|
|
bat_path = builder.current_folder.joinpath("longpathenable.bat").as_posix()
|
|
|
os.system(str(bat_path))
|
|
|
result = os.popen(
|
|
|
"""reg query HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\FileSystem /v LongPathsEnabled""")
|
|
|
if "1" in result.read().strip().split(" ")[-1]:
|
|
|
- print("Long path support has enabled")
|
|
|
+ print("Long path support has enabled", flush=True)
|
|
|
else:
|
|
|
- print("Enable long path support fail.")
|
|
|
+ print("Enable long path support fail.", flush=True)
|
|
|
sys.exit(1)
|
|
|
else:
|
|
|
- print("Current windows os version is lower than windows 10, skip enable long path support")
|
|
|
+ print("Current windows os version is lower than windows 10, skip enable long path support", flush=True)
|
|
|
if is_studio_global_version:
|
|
|
builder.make_platformio()
|
|
|
else:
|
|
|
@@ -152,6 +157,6 @@ if len(sys.argv) > 2:
|
|
|
builder.make_platformio()
|
|
|
builder.recover_pip_source()
|
|
|
else:
|
|
|
- print("RT-Thread Studio version is not match")
|
|
|
+ print("RT-Thread Studio version is not match", flush=True)
|
|
|
else:
|
|
|
- print("Info:Please add RT-Thread Studio version number as parameter")
|
|
|
+ print("Info:Please add RT-Thread Studio version number as parameter", flush=True)
|