Skip to content

Commit

Permalink
update platformio to 5.0.3.10
Browse files Browse the repository at this point in the history
  • Loading branch information
dh-04 committed Dec 8, 2020
1 parent 0638083 commit 62e8a8f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 13 deletions.
2 changes: 1 addition & 1 deletion platformio_support_package.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
yaml_version: 1
pkg_version: 5.0.3.9
pkg_version: 5.0.3.10
pkg_vendor: RealThread
pkg_type: ThirdParty_Support_Packages
name: PlatformIO
Expand Down
29 changes: 17 additions & 12 deletions script.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,20 +82,24 @@ def cp_fr_list(self, item_list, src_path, dst_path):
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")):
Expand All @@ -104,12 +108,13 @@ def copy_platformio_packages(self):
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()
Expand All @@ -124,34 +129,34 @@ def make_platformio(self):
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:
builder.modify_pip_source()
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)

0 comments on commit 62e8a8f

Please sign in to comment.