Browse Source

Fix compatibility issues between python 2.7 and 3.X

i18n
Xose Pérez 6 years ago
parent
commit
b8bd302153
3 changed files with 11 additions and 8 deletions
  1. +9
    -5
      code/memanalyzer.py
  2. +2
    -2
      code/ota.py
  3. +0
    -1
      code/requirements.txt

+ 9
- 5
code/memanalyzer.py View File

@ -19,11 +19,15 @@ import argparse
import os import os
import re import re
import shlex import shlex
import subprocess
import sys import sys
from collections import OrderedDict from collections import OrderedDict
from sortedcontainers import SortedDict from sortedcontainers import SortedDict
import subprocess
if (sys.version_info > (3, 0)):
from subprocess import getstatusoutput as getstatusoutput
else:
from commands import getstatusoutput as getstatusoutput
# ------------------------------------------------------------------------------- # -------------------------------------------------------------------------------
@ -112,7 +116,6 @@ def modules_get():
del modules_['NETBIOS'] del modules_['NETBIOS']
return modules_ return modules_
try: try:
# Parse command line options # Parse command line options
@ -126,9 +129,10 @@ try:
print() print()
print(description) print(description)
print() print()
# Check xtensa-lx106-elf-objdump is in the path # Check xtensa-lx106-elf-objdump is in the path
status, result = subprocess.getstatusoutput(objdump_binary)
if status != 512:
status, result = getstatusoutput(objdump_binary)
if status != 2 and status != 512:
print("xtensa-lx106-elf-objdump not found, please check it is in your PATH") print("xtensa-lx106-elf-objdump not found, please check it is in your PATH")
sys.exit(1) sys.exit(1)


+ 2
- 2
code/ota.py View File

@ -72,7 +72,7 @@ def list():
"SDK_SIZE", "SDK_SIZE",
"FREE_SPACE" "FREE_SPACE"
)) ))
print "-" * 146
print("-" * 146)
index = 0 index = 0
for device in devices: for device in devices:
@ -195,7 +195,7 @@ if __name__ == '__main__':
zeroconf.close() zeroconf.close()
if len(devices) == 0: if len(devices) == 0:
print "Nothing found!\n"
print("Nothing found!\n")
sys.exit(0) sys.exit(0)
# Sort list # Sort list


+ 0
- 1
code/requirements.txt View File

@ -1,5 +1,4 @@
enum-compat==0.0.2 enum-compat==0.0.2
enum34==1.1.6
netifaces==0.10.6 netifaces==0.10.6
ordereddict==1.1 ordereddict==1.1
six==1.11.0 six==1.11.0


Loading…
Cancel
Save