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