mirror of
https://github.com/platformio/platformio-core.git
synced 2025-07-30 10:07:14 +02:00
Cache long command for "gcc-ar"
This commit is contained in:
@ -1,7 +1,7 @@
|
|||||||
# Copyright (C) Ivan Kravets <me@ikravets.com>
|
# Copyright (C) Ivan Kravets <me@ikravets.com>
|
||||||
# See LICENSE for details.
|
# See LICENSE for details.
|
||||||
|
|
||||||
VERSION = (1, 1, 0)
|
VERSION = (1, 2, "0.dev0")
|
||||||
__version__ = ".".join([str(s) for s in VERSION])
|
__version__ = ".".join([str(s) for s in VERSION])
|
||||||
|
|
||||||
__title__ = "platformio"
|
__title__ = "platformio"
|
||||||
|
@ -1,29 +1,21 @@
|
|||||||
# Copyright (C) Ivan Kravets <me@ikravets.com>
|
# Copyright (C) Ivan Kravets <me@ikravets.com>
|
||||||
# See LICENSE for details.
|
# See LICENSE for details.
|
||||||
|
|
||||||
import atexit
|
from hashlib import md5
|
||||||
from os import remove
|
from os.path import join
|
||||||
from tempfile import mkstemp
|
from tempfile import gettempdir
|
||||||
|
|
||||||
MAX_SOURCES_LENGTH = 8000 # Windows CLI has limit with command length to 8192
|
MAX_SOURCES_LENGTH = 8000 # Windows CLI has limit with command length to 8192
|
||||||
|
|
||||||
|
|
||||||
def _remove_tmpfile(path):
|
|
||||||
try:
|
|
||||||
remove(path)
|
|
||||||
except WindowsError: # pylint: disable=E0602
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
def _huge_sources_hook(sources):
|
def _huge_sources_hook(sources):
|
||||||
if len(str(sources)) < MAX_SOURCES_LENGTH:
|
_sources = str(sources).replace("\\", "/")
|
||||||
|
if len(str(_sources)) < MAX_SOURCES_LENGTH:
|
||||||
return sources
|
return sources
|
||||||
|
|
||||||
_, tmp_file = mkstemp()
|
tmp_file = join(gettempdir(), "pioarargs-%s" % md5(_sources).hexdigest())
|
||||||
with open(tmp_file, "w") as f:
|
with open(tmp_file, "w") as f:
|
||||||
f.write(str(sources).replace("\\", "/"))
|
f.write(_sources)
|
||||||
|
|
||||||
atexit.register(_remove_tmpfile, tmp_file)
|
|
||||||
|
|
||||||
return "@%s" % tmp_file
|
return "@%s" % tmp_file
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user