parent
50782078d0
commit
67ae12bf1d
|
|
@ -14,6 +14,7 @@ except ImportError:
|
||||||
IU_PER_MM = 1
|
IU_PER_MM = 1
|
||||||
IU_PER_MILS = 1
|
IU_PER_MILS = 1
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
import shlex
|
||||||
from shutil import copy2
|
from shutil import copy2
|
||||||
from sys import exit, exc_info
|
from sys import exit, exc_info
|
||||||
from traceback import extract_stack, format_list, print_tb
|
from traceback import extract_stack, format_list, print_tb
|
||||||
|
|
@ -189,6 +190,7 @@ class GS(object):
|
||||||
global_kicad_dnp_applied = None
|
global_kicad_dnp_applied = None
|
||||||
global_kicad_dnp_applies_to_3D = None
|
global_kicad_dnp_applies_to_3D = None
|
||||||
global_cross_using_kicad = None
|
global_cross_using_kicad = None
|
||||||
|
pasteable_cmd = shlex.join if hasattr(shlex, 'join') else lambda x: str(x) # novermin
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def set_sch(name):
|
def set_sch(name):
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,6 @@ import os
|
||||||
import re
|
import re
|
||||||
from sys import exit
|
from sys import exit
|
||||||
from sys import path as sys_path
|
from sys import path as sys_path
|
||||||
import shlex
|
|
||||||
from shutil import which, copy2
|
from shutil import which, copy2
|
||||||
from subprocess import run, PIPE, STDOUT, Popen, CalledProcessError
|
from subprocess import run, PIPE, STDOUT, Popen, CalledProcessError
|
||||||
from glob import glob
|
from glob import glob
|
||||||
|
|
@ -154,7 +153,7 @@ def _run_command(command, change_to):
|
||||||
|
|
||||||
|
|
||||||
def run_command(command, change_to=None, just_raise=False, use_x11=False):
|
def run_command(command, change_to=None, just_raise=False, use_x11=False):
|
||||||
logger.debug('Executing: '+shlex.join(command))
|
logger.debug('Executing: '+GS.pasteable_cmd(command))
|
||||||
if change_to is not None:
|
if change_to is not None:
|
||||||
logger.debug('- CWD: '+change_to)
|
logger.debug('- CWD: '+change_to)
|
||||||
try:
|
try:
|
||||||
|
|
@ -176,7 +175,7 @@ def run_command(command, change_to=None, just_raise=False, use_x11=False):
|
||||||
|
|
||||||
|
|
||||||
def exec_with_retry(cmd, exit_with=None):
|
def exec_with_retry(cmd, exit_with=None):
|
||||||
cmd_str = shlex.join(cmd)
|
cmd_str = GS.pasteable_cmd(cmd)
|
||||||
logger.debug('Executing: '+cmd_str)
|
logger.debug('Executing: '+cmd_str)
|
||||||
if GS.debug_level > 2:
|
if GS.debug_level > 2:
|
||||||
logger.debug('Command line: '+str(cmd))
|
logger.debug('Command line: '+str(cmd))
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,6 @@ Dependencies:
|
||||||
import os
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
import pprint
|
import pprint
|
||||||
import shlex
|
|
||||||
from shutil import copy2
|
from shutil import copy2
|
||||||
from math import ceil
|
from math import ceil
|
||||||
from struct import unpack
|
from struct import unpack
|
||||||
|
|
@ -144,7 +143,7 @@ a:hover, a:active { text-decoration: underline;}
|
||||||
|
|
||||||
|
|
||||||
def _run_command(cmd):
|
def _run_command(cmd):
|
||||||
logger.debug('- Executing: '+shlex.join(cmd))
|
logger.debug('- Executing: '+GS.pasteable_cmd(cmd))
|
||||||
try:
|
try:
|
||||||
cmd_output = subprocess.check_output(cmd, stderr=subprocess.STDOUT)
|
cmd_output = subprocess.check_output(cmd, stderr=subprocess.STDOUT)
|
||||||
except subprocess.CalledProcessError as e:
|
except subprocess.CalledProcessError as e:
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,6 @@ import os
|
||||||
import subprocess
|
import subprocess
|
||||||
import importlib
|
import importlib
|
||||||
from pcbnew import B_Cu, B_Mask, F_Cu, F_Mask, FromMM, IsCopperLayer, LSET, PLOT_CONTROLLER, PLOT_FORMAT_SVG
|
from pcbnew import B_Cu, B_Mask, F_Cu, F_Mask, FromMM, IsCopperLayer, LSET, PLOT_CONTROLLER, PLOT_FORMAT_SVG
|
||||||
import shlex
|
|
||||||
from shutil import rmtree
|
from shutil import rmtree
|
||||||
from tempfile import NamedTemporaryFile, mkdtemp
|
from tempfile import NamedTemporaryFile, mkdtemp
|
||||||
from .error import KiPlotConfigurationError
|
from .error import KiPlotConfigurationError
|
||||||
|
|
@ -73,7 +72,7 @@ def pcbdraw_warnings(tag, msg):
|
||||||
|
|
||||||
|
|
||||||
def _run_command(cmd):
|
def _run_command(cmd):
|
||||||
logger.debug('- Executing: '+shlex.join(cmd))
|
logger.debug('- Executing: '+GS.pasteable_cmd(cmd))
|
||||||
try:
|
try:
|
||||||
cmd_output = subprocess.check_output(cmd, stderr=subprocess.STDOUT)
|
cmd_output = subprocess.check_output(cmd, stderr=subprocess.STDOUT)
|
||||||
except subprocess.CalledProcessError as e:
|
except subprocess.CalledProcessError as e:
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,6 @@ Dependencies:
|
||||||
role: Automatically adjust SVG margin
|
role: Automatically adjust SVG margin
|
||||||
"""
|
"""
|
||||||
import os
|
import os
|
||||||
import shlex
|
|
||||||
import subprocess
|
import subprocess
|
||||||
from tempfile import NamedTemporaryFile
|
from tempfile import NamedTemporaryFile
|
||||||
# Here we import the whole module to make monkeypatch work
|
# Here we import the whole module to make monkeypatch work
|
||||||
|
|
@ -52,7 +51,7 @@ def _get_tmp_name(ext):
|
||||||
|
|
||||||
|
|
||||||
def _run_command(cmd):
|
def _run_command(cmd):
|
||||||
logger.debug('Executing: '+shlex.join(cmd))
|
logger.debug('Executing: '+GS.pasteable_cmd(cmd))
|
||||||
try:
|
try:
|
||||||
cmd_output = subprocess.check_output(cmd, stderr=subprocess.STDOUT)
|
cmd_output = subprocess.check_output(cmd, stderr=subprocess.STDOUT)
|
||||||
except subprocess.CalledProcessError as e:
|
except subprocess.CalledProcessError as e:
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,6 @@ Dependencies:
|
||||||
role: Automatically crop images
|
role: Automatically crop images
|
||||||
"""
|
"""
|
||||||
import os
|
import os
|
||||||
import shlex
|
|
||||||
import subprocess
|
import subprocess
|
||||||
from .misc import (RENDER_3D_ERR, PCB_MAT_COLORS, PCB_FINISH_COLORS, SOLDER_COLORS, SILK_COLORS,
|
from .misc import (RENDER_3D_ERR, PCB_MAT_COLORS, PCB_FINISH_COLORS, SOLDER_COLORS, SILK_COLORS,
|
||||||
KICAD_VERSION_6_0_2, MISSING_TOOL)
|
KICAD_VERSION_6_0_2, MISSING_TOOL)
|
||||||
|
|
@ -26,7 +25,7 @@ logger = log.get_logger()
|
||||||
|
|
||||||
|
|
||||||
def _run_command(cmd):
|
def _run_command(cmd):
|
||||||
logger.debug('- Executing: '+shlex.join(cmd))
|
logger.debug('- Executing: '+GS.pasteable_cmd(cmd))
|
||||||
try:
|
try:
|
||||||
cmd_output = subprocess.check_output(cmd, stderr=subprocess.STDOUT)
|
cmd_output = subprocess.check_output(cmd, stderr=subprocess.STDOUT)
|
||||||
except subprocess.CalledProcessError as e:
|
except subprocess.CalledProcessError as e:
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,6 @@ Dependencies:
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import pcbnew
|
import pcbnew
|
||||||
import shlex
|
|
||||||
from subprocess import check_output, STDOUT, CalledProcessError
|
from subprocess import check_output, STDOUT, CalledProcessError
|
||||||
|
|
||||||
from .gs import GS
|
from .gs import GS
|
||||||
|
|
@ -851,7 +850,7 @@ class ReportOptions(BaseOptions):
|
||||||
if not out.endswith('.'+self.convert_to):
|
if not out.endswith('.'+self.convert_to):
|
||||||
logger.warning(W_WRONGEXT+'The conversion tool detects the output format using the extension')
|
logger.warning(W_WRONGEXT+'The conversion tool detects the output format using the extension')
|
||||||
cmd = [command, '--from', self.convert_from, resources, fname, '-o', out]
|
cmd = [command, '--from', self.convert_from, resources, fname, '-o', out]
|
||||||
logger.debug('Executing: '+shlex.join(cmd))
|
logger.debug('Executing: '+GS.pasteable_cmd(cmd))
|
||||||
try:
|
try:
|
||||||
check_output(cmd, stderr=STDOUT)
|
check_output(cmd, stderr=STDOUT)
|
||||||
except CalledProcessError as e:
|
except CalledProcessError as e:
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,6 @@ Dependencies:
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import shlex
|
|
||||||
from subprocess import run, PIPE
|
from subprocess import run, PIPE
|
||||||
import sys
|
import sys
|
||||||
from .error import KiPlotConfigurationError
|
from .error import KiPlotConfigurationError
|
||||||
|
|
@ -132,7 +131,7 @@ class Set_Text_Variables(BasePreFlight): # noqa: F821
|
||||||
if not bash_command:
|
if not bash_command:
|
||||||
bash_command = self.ensure_tool('Bash')
|
bash_command = self.ensure_tool('Bash')
|
||||||
cmd = [bash_command, '-c', command]
|
cmd = [bash_command, '-c', command]
|
||||||
logger.debug('Executing: '+shlex.join(command))
|
logger.debug('Executing: '+GS.pasteable_cmd(command))
|
||||||
result = run(cmd, stdout=PIPE, stderr=PIPE, universal_newlines=True)
|
result = run(cmd, stdout=PIPE, stderr=PIPE, universal_newlines=True)
|
||||||
if result.returncode:
|
if result.returncode:
|
||||||
logger.error('Failed to execute:\n{}\nreturn code {}'.format(r.command, result.returncode))
|
logger.error('Failed to execute:\n{}\nreturn code {}'.format(r.command, result.returncode))
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue