forked from platformio/platformio-core
Initial support for non-ascii locales
This commit is contained in:
2
docs
2
docs
Submodule docs updated: 1ceb1ce707...06258ad914
@@ -170,7 +170,8 @@ if "envdump" in COMMAND_LINE_TARGETS:
|
|||||||
|
|
||||||
if "idedata" in COMMAND_LINE_TARGETS:
|
if "idedata" in COMMAND_LINE_TARGETS:
|
||||||
try:
|
try:
|
||||||
print "\n%s\n" % json.dumps(env.DumpIDEData())
|
print "\n%s\n" % util.path_to_unicode(
|
||||||
|
json.dumps(env.DumpIDEData(), ensure_ascii=False))
|
||||||
env.Exit(0)
|
env.Exit(0)
|
||||||
except UnicodeDecodeError:
|
except UnicodeDecodeError:
|
||||||
sys.stderr.write(
|
sys.stderr.write(
|
||||||
|
@@ -64,8 +64,8 @@ def dump_defines(env):
|
|||||||
# special symbol for Atmel AVR MCU
|
# special symbol for Atmel AVR MCU
|
||||||
if env['PIOPLATFORM'] == "atmelavr":
|
if env['PIOPLATFORM'] == "atmelavr":
|
||||||
defines.append(
|
defines.append(
|
||||||
"__AVR_%s__" % env.BoardConfig().get("build.mcu").upper()
|
str("__AVR_%s__" % env.BoardConfig().get("build.mcu").upper()
|
||||||
.replace("ATMEGA", "ATmega").replace("ATTINY", "ATtiny"))
|
.replace("ATMEGA", "ATmega").replace("ATTINY", "ATtiny")))
|
||||||
return defines
|
return defines
|
||||||
|
|
||||||
|
|
||||||
|
@@ -20,8 +20,12 @@ from platformio.managers.core import pioplus_call
|
|||||||
|
|
||||||
|
|
||||||
@click.command("home", short_help="PIO Home")
|
@click.command("home", short_help="PIO Home")
|
||||||
|
@click.option("--port", type=int, default=8008, help="HTTP port, default=8008")
|
||||||
@click.option(
|
@click.option(
|
||||||
"--port", "-p", type=int, default=8008, help="HTTP port, default=8008")
|
"--host",
|
||||||
|
default="127.0.0.1",
|
||||||
|
help="HTTP host, default=127.0.0.1. "
|
||||||
|
"You can open PIO Home for inbound connections with --host=0.0.0.0")
|
||||||
@click.option("--no-open", is_flag=True)
|
@click.option("--no-open", is_flag=True)
|
||||||
def cli(*args, **kwargs): # pylint: disable=unused-argument
|
def cli(*args, **kwargs): # pylint: disable=unused-argument
|
||||||
pioplus_call(sys.argv[1:])
|
pioplus_call(sys.argv[1:])
|
||||||
|
@@ -15,7 +15,7 @@
|
|||||||
from email.utils import parsedate_tz
|
from email.utils import parsedate_tz
|
||||||
from math import ceil
|
from math import ceil
|
||||||
from os.path import getsize, join
|
from os.path import getsize, join
|
||||||
from sys import version_info
|
from sys import getfilesystemencoding, version_info
|
||||||
from time import mktime
|
from time import mktime
|
||||||
|
|
||||||
import click
|
import click
|
||||||
@@ -53,7 +53,8 @@ class FileDownloader(object):
|
|||||||
self._progressbar = None
|
self._progressbar = None
|
||||||
self._destination = self._fname
|
self._destination = self._fname
|
||||||
if dest_dir:
|
if dest_dir:
|
||||||
self.set_destination(join(dest_dir, self._fname))
|
self.set_destination(
|
||||||
|
join(dest_dir.decode(getfilesystemencoding()), self._fname))
|
||||||
|
|
||||||
def set_destination(self, destination):
|
def set_destination(self, destination):
|
||||||
self._destination = destination
|
self._destination = destination
|
||||||
|
@@ -15,11 +15,10 @@
|
|||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
from cStringIO import StringIO
|
|
||||||
from os.path import abspath, basename, expanduser, isdir, isfile, join, relpath
|
from os.path import abspath, basename, expanduser, isdir, isfile, join, relpath
|
||||||
|
|
||||||
import bottle
|
import bottle
|
||||||
import click
|
from click.testing import CliRunner
|
||||||
|
|
||||||
from platformio import exception, util
|
from platformio import exception, util
|
||||||
from platformio.commands.run import cli as cmd_run
|
from platformio.commands.run import cli as cmd_run
|
||||||
@@ -65,19 +64,18 @@ class ProjectGenerator(object):
|
|||||||
if not envdata:
|
if not envdata:
|
||||||
return data
|
return data
|
||||||
|
|
||||||
out = StringIO()
|
result = CliRunner().invoke(cmd_run, [
|
||||||
with util.capture_stdout(out):
|
"--project-dir", self.project_dir, "--environment",
|
||||||
click.get_current_context().invoke(
|
envdata['env_name'], "--target", "idedata"
|
||||||
cmd_run,
|
])
|
||||||
project_dir=self.project_dir,
|
|
||||||
environment=[envdata['env_name']],
|
|
||||||
target=["idedata"])
|
|
||||||
result = out.getvalue()
|
|
||||||
|
|
||||||
if '"includes":' not in result:
|
if result.exit_code != 0 and not isinstance(result.exception,
|
||||||
raise exception.PlatformioException(result)
|
exception.ReturnErrorCode):
|
||||||
|
raise result.exception
|
||||||
|
if '"includes":' not in result.output:
|
||||||
|
raise exception.PlatformioException(result.output)
|
||||||
|
|
||||||
for line in result.split("\n"):
|
for line in result.output.split("\n"):
|
||||||
line = line.strip()
|
line = line.strip()
|
||||||
if line.startswith('{"') and line.endswith("}"):
|
if line.startswith('{"') and line.endswith("}"):
|
||||||
data = json.loads(line)
|
data = json.loads(line)
|
||||||
|
@@ -21,9 +21,9 @@ from platformio import __version__, exception, util
|
|||||||
from platformio.managers.package import PackageManager
|
from platformio.managers.package import PackageManager
|
||||||
|
|
||||||
CORE_PACKAGES = {
|
CORE_PACKAGES = {
|
||||||
"contrib-piohome": ">=0.3.0,<2",
|
"contrib-piohome": ">=0.3.2,<2",
|
||||||
"pysite-pioplus": ">=0.4.2,<2",
|
"pysite-pioplus": ">=0.4.2,<2",
|
||||||
"tool-pioplus": ">=0.10.10,<2",
|
"tool-pioplus": ">=0.10.13,<2",
|
||||||
"tool-unity": "~1.20302.1",
|
"tool-unity": "~1.20302.1",
|
||||||
"tool-scons": "~3.20501.2"
|
"tool-scons": "~3.20501.2"
|
||||||
}
|
}
|
||||||
|
@@ -18,6 +18,7 @@ import json
|
|||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import shutil
|
import shutil
|
||||||
|
import sys
|
||||||
from os.path import basename, getsize, isdir, isfile, islink, join
|
from os.path import basename, getsize, isdir, isfile, islink, join
|
||||||
from tempfile import mkdtemp
|
from tempfile import mkdtemp
|
||||||
|
|
||||||
@@ -195,7 +196,7 @@ class PkgInstallerMixin(object):
|
|||||||
name = re.sub(r"[^\da-z\_\-\. ]", "_", manifest['name'], flags=re.I)
|
name = re.sub(r"[^\da-z\_\-\. ]", "_", manifest['name'], flags=re.I)
|
||||||
if "id" in manifest:
|
if "id" in manifest:
|
||||||
name += "_ID%d" % manifest['id']
|
name += "_ID%d" % manifest['id']
|
||||||
return name
|
return str(name)
|
||||||
|
|
||||||
def get_src_manifest_path(self, pkg_dir):
|
def get_src_manifest_path(self, pkg_dir):
|
||||||
if not isdir(pkg_dir):
|
if not isdir(pkg_dir):
|
||||||
@@ -258,7 +259,7 @@ class PkgInstallerMixin(object):
|
|||||||
if "version" not in manifest:
|
if "version" not in manifest:
|
||||||
manifest['version'] = "0.0.0"
|
manifest['version'] = "0.0.0"
|
||||||
|
|
||||||
manifest['__pkg_dir'] = pkg_dir
|
manifest['__pkg_dir'] = util.path_to_unicode(pkg_dir)
|
||||||
self.cache_set(cache_key, manifest)
|
self.cache_set(cache_key, manifest)
|
||||||
return manifest
|
return manifest
|
||||||
|
|
||||||
|
@@ -21,7 +21,6 @@ import re
|
|||||||
import stat
|
import stat
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
from contextlib import contextmanager
|
|
||||||
from functools import wraps
|
from functools import wraps
|
||||||
from glob import glob
|
from glob import glob
|
||||||
from os.path import (abspath, basename, dirname, expanduser, isdir, isfile,
|
from os.path import (abspath, basename, dirname, expanduser, isdir, isfile,
|
||||||
@@ -180,12 +179,8 @@ def singleton(cls):
|
|||||||
return get_instance
|
return get_instance
|
||||||
|
|
||||||
|
|
||||||
@contextmanager
|
def path_to_unicode(path):
|
||||||
def capture_stdout(output):
|
return path.decode(sys.getfilesystemencoding()).encode("utf-8")
|
||||||
stdout = sys.stdout
|
|
||||||
sys.stdout = output
|
|
||||||
yield
|
|
||||||
sys.stdout = stdout
|
|
||||||
|
|
||||||
|
|
||||||
def load_json(file_path):
|
def load_json(file_path):
|
||||||
|
Reference in New Issue
Block a user