Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Barry
/
esp8266-Mud
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Network
Create a new issue
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
bb26558b
authored
2018-05-03 23:45:00 -0700
by
Barry
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Updated release script to use pyserial to automatically create subdirs for
uploader.
1 parent
ade0b68b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
15 deletions
release.py
release.py
View file @
bb26558
import
serial
import
io
import
os
import
sys
PORT
=
'COM17'
BAUDRATE
=
115200
IPADDRESS
=
' 192.168.1.122'
folders
=
[
'help'
,
'rooms'
,
'inventory'
,
'commands'
,
'mobs'
]
files
=
[
"commandhandler.py"
,
"inventoryhandler.py"
,
...
...
@@ -14,24 +22,40 @@ files = [
"wifiweb.py"
]
for
f
in
os
.
listdir
(
'help'
):
files
.
append
(
'help/'
+
f
)
for
f
in
os
.
listdir
(
'rooms'
):
files
.
append
(
'rooms/'
+
f
)
for
f
in
os
.
listdir
(
'inventory'
):
files
.
append
(
'inventory/'
+
f
)
for
f
in
os
.
listdir
(
'commands'
):
files
.
append
(
'commands/'
+
f
)
for
f
in
os
.
listdir
(
'mobs'
):
files
.
append
(
'mobs/'
+
f
)
def
run_command
(
sio
,
command
,
expected
=
'>>>'
):
sio
.
write
(
"{}
\n
"
.
format
(
command
))
sio
.
flush
()
# it is buffering. required to get the data out *now*
res
=
''
while
expected
not
in
res
:
res
=
sio
.
readline
()
# print(res)
return
res
with
serial
.
Serial
(
PORT
,
BAUDRATE
,
timeout
=
1
)
as
ser
:
sio
=
io
.
TextIOWrapper
(
io
.
BufferedRWPair
(
ser
,
ser
))
run_command
(
sio
,
'import os'
)
root
=
eval
(
run_command
(
sio
,
'os.listdir()'
,
expected
=
']'
))
if
not
set
(
folders
)
.
issubset
(
root
):
print
(
'Creating folders.'
)
# we are missing folders so they need to be created.
for
folder
in
folders
:
if
folder
in
root
:
continue
print
(
'Creating folder: {}'
.
format
(
folder
))
run_command
(
sio
,
'os.mkdir("{}")'
.
format
(
folder
))
else
:
print
(
'Folders already created.'
)
for
folder
in
folders
:
for
f
in
os
.
listdir
(
folder
):
files
.
append
(
'{}/{}'
.
format
(
folder
,
f
))
with
open
(
'releasepw.conf'
,
'r'
,
encoding
=
'utf-8'
)
as
f
:
password
=
f
.
read
()
for
file
in
files
:
os
.
system
(
"python webrepl
\
webrepl_cli.py -p {} {}
192.168.1.138:/{}"
.
format
(
password
,
file
,
file
))
os
.
system
(
"python webrepl
\
webrepl_cli.py -p {} {}
{}:/{}"
.
format
(
password
,
file
,
IPADDRESS
,
file
))
...
...
Please
register
or
sign in
to post a comment