forked from platformio/platformio-core
Improved system type detection
This commit is contained in:
@ -12,7 +12,6 @@ from SCons.Script import (AlwaysBuild, Builder, COMMAND_LINE_TARGETS, Default,
|
||||
|
||||
from platformio.util import reset_serialport
|
||||
|
||||
|
||||
env = DefaultEnvironment()
|
||||
|
||||
env.Replace(
|
||||
|
@ -7,13 +7,11 @@
|
||||
"""
|
||||
|
||||
from os.path import join
|
||||
from platform import system
|
||||
|
||||
from SCons.Script import (AlwaysBuild, Builder, COMMAND_LINE_TARGETS, Default,
|
||||
DefaultEnvironment)
|
||||
|
||||
from platformio.util import get_system
|
||||
|
||||
|
||||
env = DefaultEnvironment()
|
||||
|
||||
env.Replace(
|
||||
@ -55,7 +53,7 @@ env.Replace(
|
||||
|
||||
UPLOADER=join("$PLATFORMTOOLS_DIR", "mspdebug", "mspdebug"),
|
||||
UPLOADERFLAGS=[
|
||||
"$UPLOAD_PROTOCOL" if get_system() != "windows32" else "tilib",
|
||||
"$UPLOAD_PROTOCOL" if system() != "Windows" else "tilib",
|
||||
"--force-reset"
|
||||
],
|
||||
UPLOADCMD='$UPLOADER $UPLOADERFLAGS "prog $SOURCES"'
|
||||
|
@ -11,7 +11,6 @@ from os.path import join
|
||||
from SCons.Script import (AlwaysBuild, Builder, COMMAND_LINE_TARGETS, Default,
|
||||
DefaultEnvironment)
|
||||
|
||||
|
||||
env = DefaultEnvironment()
|
||||
|
||||
env.Replace(
|
||||
|
@ -14,7 +14,7 @@ from platformio.downloader import FileDownloader
|
||||
from platformio.exception import (InvalidPackageVersion, NonSystemPackage,
|
||||
UnknownPackage)
|
||||
from platformio.unpacker import FileUnpacker
|
||||
from platformio.util import get_home_dir, get_system
|
||||
from platformio.util import get_home_dir, get_systype
|
||||
|
||||
|
||||
class PackageManager(object):
|
||||
@ -66,11 +66,11 @@ class PackageManager(object):
|
||||
raise UnknownPackage(name)
|
||||
|
||||
# check system platform
|
||||
system = get_system()
|
||||
builds = ([b for b in manifest[name] if b['system'] == "all" or system
|
||||
systype = get_systype()
|
||||
builds = ([b for b in manifest[name] if b['system'] == "all" or systype
|
||||
in b['system']])
|
||||
if not builds:
|
||||
raise NonSystemPackage(name, system)
|
||||
raise NonSystemPackage(name, systype)
|
||||
|
||||
if version:
|
||||
for b in builds:
|
||||
|
@ -4,7 +4,7 @@
|
||||
from os import name as os_name
|
||||
from os import getcwd, getenv, listdir, utime
|
||||
from os.path import dirname, expanduser, isfile, join, realpath
|
||||
from platform import architecture, system
|
||||
from platform import system, uname
|
||||
from subprocess import PIPE, Popen
|
||||
from time import sleep
|
||||
|
||||
@ -18,8 +18,11 @@ except ImportError:
|
||||
from ConfigParser import ConfigParser
|
||||
|
||||
|
||||
def get_system():
|
||||
return (system() + architecture()[0][:-3]).lower()
|
||||
def get_systype():
|
||||
if system() == "Windows":
|
||||
return "windows"
|
||||
data = uname()
|
||||
return ("%s_%s" % (data[0], data[4])).lower()
|
||||
|
||||
|
||||
def get_home_dir():
|
||||
@ -61,7 +64,7 @@ def change_filemtime(path, time):
|
||||
|
||||
|
||||
def exec_command(args):
|
||||
use_shell = get_system() == "windows32"
|
||||
use_shell = system() == "Windows"
|
||||
p = Popen(args, stdout=PIPE, stderr=PIPE, shell=use_shell)
|
||||
out, err = p.communicate()
|
||||
return dict(out=out.strip(), err=err.strip())
|
||||
|
Reference in New Issue
Block a user