Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit1e31eb8

Browse files
committed
fixes repl for unix and macOS build
There was a change I had made that would not allow more advanced things like history to be available when using the repl. I have fixed this issue.I also started working on adding a roll back to restore all micropython code back to it's originals upon build failure and also when a build completes sucessfully. This allows for keeping micropython scrubbed of any changes in the event a user wants to compile for a different port. While I am not modifying anything outside of the the port directories at the moment the need might arrise at some point in time.
1 parent93815a3 commit1e31eb8

File tree

5 files changed

+434
-463
lines changed

5 files changed

+434
-463
lines changed

‎builder/__init__.py‎

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,85 @@
88
_windows_env=None
99

1010

11+
defscrub_build_folder():
12+
forfinos.listdir('build'):
13+
f=os.path.join('build',f)
14+
forpatternin ('.h','manifest.py','.board'):
15+
iff.endswith(pattern):
16+
os.remove(f)
17+
18+
19+
defrevert_files(port):
20+
ifportin ('macOS','raspberry_pi'):
21+
revert_files('unix')
22+
23+
src_path=f'micropy_updates/originals/{port}'
24+
25+
ifportin ('raspberry_pi','macOS'):
26+
port='unix'
27+
28+
dst_path=f'lib/micropython/ports/{port}'
29+
30+
ifnotos.path.exists(src_path)ornotos.listdir(src_path):
31+
return
32+
33+
defiter_path(src_p,dst_p):
34+
forfileinos.listdir(src_p):
35+
src_file=os.path.join(src_p,file)
36+
dst_file=os.path.join(dst_p,file)
37+
38+
ifos.path.isdir(src_file):
39+
iter_path(src_file,dst_file)
40+
os.rmdir(src_file)
41+
else:
42+
read_file(src_file,dst_file)
43+
os.remove(src_file)
44+
45+
iter_path(src_path,dst_path)
46+
47+
48+
defcopy_updated_files(port):
49+
50+
src_path=f'micropy_updates/{port}'
51+
originals_path=f'micropy_updates/originals/{port}'
52+
53+
ifportin ('raspberry_pi','macOS'):
54+
port='unix'
55+
56+
dst_path=f'lib/micropython/ports/{port}'
57+
58+
forfileinos.listdir(src_path):
59+
60+
src_file=os.path.join(dst_path,file)
61+
dst_file=os.path.join(originals_path,file)
62+
63+
read_file(src_file,dst_file)
64+
65+
src_file=os.path.join(src_path,file)
66+
dst_file=os.path.join(dst_path,file)
67+
68+
read_file(src_file,dst_file)
69+
70+
71+
defwrite_file(file,data):
72+
withopen(file,'wb')asf:
73+
f.write(data.encode('utf-8'))
74+
75+
76+
defread_file(file,save_file):
77+
withopen(file,'rb')asf1:
78+
data=f1.read()
79+
80+
save_path=os.path.split(save_file)[0]
81+
ifnotos.path.exists(save_path):
82+
os.makedirs(save_path)
83+
84+
withopen(save_file,'wb')asf2:
85+
f2.write(data)
86+
87+
returndata.decode('utf-8')
88+
89+
1190
defsetup_windows_build():
1291

1392
global_windows_env

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp