after_merge
stringlengths 28
79.6k
| before_merge
stringlengths 20
79.6k
| url
stringlengths 38
71
| full_traceback
stringlengths 43
922k
| traceback_type
stringclasses 555
values |
|---|---|---|---|---|
def show_config(config):
parser = configparser.RawConfigParser()
if not config.envlist_explicit or reporter.verbosity() >= reporter.Verbosity.INFO:
tox_info(config, parser)
version_info(parser)
tox_envs_info(config, parser)
content = StringIO()
parser.write(content)
value = content.getvalue().rstrip()
reporter.verbosity0(value)
|
def show_config(config):
parser = configparser.ConfigParser()
if not config.envlist_explicit or reporter.verbosity() >= reporter.Verbosity.INFO:
tox_info(config, parser)
version_info(parser)
tox_envs_info(config, parser)
content = StringIO()
parser.write(content)
value = content.getvalue().rstrip()
reporter.verbosity0(value)
|
https://github.com/tox-dev/tox/issues/1584
|
test git:(master) β do_not_interpolate=test tox --showconfig -rvv -e test
using tox.ini: /home/avass/git/opendev/zuul/zuul-jobs/test/tox.ini (pid 1006532)
removing /home/avass/git/opendev/zuul/zuul-jobs/test/.tox/log
using tox-3.11.0 from /home/avass/.local/lib/python3.7/site-packages/tox/__init__.py (pid 1006532)
Traceback (most recent call last):
File "/home/avass/.local/bin/tox", line 10, in <module>
sys.exit(cmdline())
File "/home/avass/.local/lib/python3.7/site-packages/tox/session/__init__.py", line 42, in cmdline
main(args)
File "/home/avass/.local/lib/python3.7/site-packages/tox/session/__init__.py", line 66, in main
exit_code = session.runcommand()
File "/home/avass/.local/lib/python3.7/site-packages/tox/session/__init__.py", line 183, in runcommand
self.showconfig()
File "/home/avass/.local/lib/python3.7/site-packages/tox/session/__init__.py", line 266, in showconfig
show_config(self.config)
File "/home/avass/.local/lib/python3.7/site-packages/tox/session/commands/show_config.py", line 24, in show_config
tox_envs_info(config, parser)
File "/home/avass/.local/lib/python3.7/site-packages/tox/session/commands/show_config.py", line 46, in tox_envs_info
set_section(parser, section, values)
File "/home/avass/.local/lib/python3.7/site-packages/tox/session/commands/show_config.py", line 77, in set_section
parser.set(section, key, value)
File "/usr/lib64/python3.7/configparser.py", line 1198, in set
super().set(section, option, value)
File "/usr/lib64/python3.7/configparser.py", line 893, in set
value)
File "/usr/lib64/python3.7/configparser.py", line 402, in before_set
"position %d" % (value, tmp_value.find('%')))
ValueError: invalid interpolation syntax in '[[\'sh\', \'-c\', "echo \'%(do_not_interpolate)\'s"]]' at position 21
|
ValueError
|
def tox_addoption(parser):
parser.add_argument(
"--version", action="store_true", help="report version information to stdout."
)
parser.add_argument(
"-h", "--help", action="store_true", help="show help about options"
)
parser.add_argument(
"--help-ini",
"--hi",
action="store_true",
dest="helpini",
help="show help about ini-names",
)
add_verbosity_commands(parser)
parser.add_argument(
"--showconfig",
action="store_true",
help="show live configuration (by default all env, with -l only default targets,"
" specific via TOXENV/-e)",
)
parser.add_argument(
"-l",
"--listenvs",
action="store_true",
help="show list of test environments (with description if verbose)",
)
parser.add_argument(
"-a",
"--listenvs-all",
action="store_true",
help="show list of all defined environments (with description if verbose)",
)
parser.add_argument(
"-c",
dest="configfile",
help="config file name or directory with 'tox.ini' file.",
)
parser.add_argument(
"-e",
action="append",
dest="env",
metavar="envlist",
help="work against specified environments (ALL selects all).",
)
parser.add_argument(
"--devenv",
metavar="ENVDIR",
help=(
"sets up a development environment at ENVDIR based on the env's tox "
"configuration specified by `-e` (-e defaults to py)."
),
)
parser.add_argument(
"--notest", action="store_true", help="skip invoking test commands."
)
parser.add_argument(
"--sdistonly",
action="store_true",
help="only perform the sdist packaging activity.",
)
add_parallel_flags(parser)
parser.add_argument(
"--parallel--safe-build",
action="store_true",
dest="parallel_safe_build",
help="(deprecated) ensure two tox builds can run in parallel "
"(uses a lock file in the tox workdir with .lock extension)",
)
parser.add_argument(
"--installpkg",
metavar="PATH",
help="use specified package for installation into venv, instead of creating an sdist.",
)
parser.add_argument(
"--develop",
action="store_true",
help="install package in the venv using 'setup.py develop' via 'pip -e .'",
)
parser.add_argument(
"-i",
"--index-url",
action="append",
dest="indexurl",
metavar="URL",
help="set indexserver url (if URL is of form name=url set the "
"url for the 'name' indexserver, specifically)",
)
parser.add_argument(
"--pre",
action="store_true",
help="install pre-releases and development versions of dependencies. "
"This will pass the --pre option to install_command "
"(pip by default).",
)
parser.add_argument(
"-r",
"--recreate",
action="store_true",
help="force recreation of virtual environments",
)
parser.add_argument(
"--result-json",
dest="resultjson",
metavar="PATH",
help="write a json file with detailed information "
"about all commands and results involved.",
)
# We choose 1 to 4294967295 because it is the range of PYTHONHASHSEED.
parser.add_argument(
"--hashseed",
metavar="SEED",
help="set PYTHONHASHSEED to SEED before running commands. "
"Defaults to a random integer in the range [1, 4294967295] "
"([1, 1024] on Windows). "
"Passing 'noset' suppresses this behavior.",
)
parser.add_argument(
"--force-dep",
action="append",
metavar="REQ",
help="Forces a certain version of one of the dependencies "
"when configuring the virtual environment. REQ Examples "
"'pytest<2.7' or 'django>=1.6'.",
)
parser.add_argument(
"--sitepackages",
action="store_true",
help="override sitepackages setting to True in all envs",
)
parser.add_argument(
"--alwayscopy",
action="store_true",
help="override alwayscopy setting to True in all envs",
)
cli_skip_missing_interpreter(parser)
parser.add_argument("--workdir", metavar="PATH", help="tox working directory")
parser.add_argument(
"args",
nargs="*",
help="additional arguments available to command positional substitution",
)
def _set_envdir_from_devenv(testenv_config, value):
if testenv_config.config.option.devenv is not None:
return py.path.local(testenv_config.config.option.devenv)
else:
return value
parser.add_testenv_attribute(
name="envdir",
type="path",
default="{toxworkdir}/{envname}",
help="set venv directory -- be very careful when changing this as tox "
"will remove this directory when recreating an environment",
postprocess=_set_envdir_from_devenv,
)
# add various core venv interpreter attributes
def setenv(testenv_config, value):
setenv = value
config = testenv_config.config
if "PYTHONHASHSEED" not in setenv and config.hashseed is not None:
setenv["PYTHONHASHSEED"] = config.hashseed
setenv["TOX_ENV_NAME"] = str(testenv_config.envname)
setenv["TOX_ENV_DIR"] = str(testenv_config.envdir)
return setenv
parser.add_testenv_attribute(
name="setenv",
type="dict_setenv",
postprocess=setenv,
help="list of X=Y lines with environment variable settings",
)
def basepython_default(testenv_config, value):
"""either user set or proposed from the factor name
in both cases we check that the factor name implied python version and the resolved
python interpreter version match up; if they don't we warn, unless ignore base
python conflict is set in which case the factor name implied version if forced
"""
for factor in testenv_config.factors:
match = tox.PYTHON.PY_FACTORS_RE.match(factor)
if match:
base_exe = {"py": "python"}.get(match.group(1), match.group(1))
version_s = match.group(2)
if not version_s:
version_info = ()
elif len(version_s) == 1:
version_info = (version_s,)
else:
version_info = (version_s[0], version_s[1:])
implied_version = ".".join(version_info)
implied_python = "{}{}".format(base_exe, implied_version)
break
else:
implied_python, version_info, implied_version = None, (), ""
if (
testenv_config.config.ignore_basepython_conflict
and implied_python is not None
):
return implied_python
proposed_python = (
(implied_python or sys.executable) if value is None else str(value)
)
if implied_python is not None and implied_python != proposed_python:
testenv_config.basepython = proposed_python
python_info_for_proposed = testenv_config.python_info
if not isinstance(python_info_for_proposed, NoInterpreterInfo):
proposed_version = ".".join(
str(x)
for x in python_info_for_proposed.version_info[: len(version_info)]
)
if proposed_version != implied_version:
# TODO(stephenfin): Raise an exception here in tox 4.0
warnings.warn(
"conflicting basepython version (set {}, should be {}) for env '{}';"
"resolve conflict or set ignore_basepython_conflict".format(
proposed_version, implied_version, testenv_config.envname
)
)
return proposed_python
parser.add_testenv_attribute(
name="basepython",
type="basepython",
default=None,
postprocess=basepython_default,
help="executable name or path of interpreter used to create a virtual test environment.",
)
def merge_description(testenv_config, value):
"""the reader by default joins generated description with new line,
replace new line with space"""
return value.replace("\n", " ")
parser.add_testenv_attribute(
name="description",
type="string",
default="",
postprocess=merge_description,
help="short description of this environment",
)
parser.add_testenv_attribute(
name="envtmpdir",
type="path",
default="{envdir}/tmp",
help="venv temporary directory",
)
parser.add_testenv_attribute(
name="envlogdir", type="path", default="{envdir}/log", help="venv log directory"
)
parser.add_testenv_attribute(
name="downloadcache",
type="string",
default=None,
help="(ignored) has no effect anymore, pip-8 uses local caching by default",
)
parser.add_testenv_attribute(
name="changedir",
type="path",
default="{toxinidir}",
help="directory to change to when running commands",
)
parser.add_testenv_attribute_obj(PosargsOption())
parser.add_testenv_attribute(
name="skip_install",
type="bool",
default=False,
help="Do not install the current package. This can be used when you need the virtualenv "
"management but do not want to install the current package",
)
parser.add_testenv_attribute(
name="ignore_errors",
type="bool",
default=False,
help="if set to True all commands will be executed irrespective of their result error "
"status.",
)
def recreate(testenv_config, value):
if testenv_config.config.option.recreate:
return True
return value
parser.add_testenv_attribute(
name="recreate",
type="bool",
default=False,
postprocess=recreate,
help="always recreate this test environment.",
)
def passenv(testenv_config, value):
# Flatten the list to deal with space-separated values.
value = list(itertools.chain.from_iterable([x.split(" ") for x in value]))
passenv = {
"PATH",
"PIP_INDEX_URL",
"LANG",
"LANGUAGE",
"LD_LIBRARY_PATH",
"TOX_WORK_DIR",
str(REPORTER_TIMESTAMP_ON_ENV),
str(PARALLEL_ENV_VAR_KEY_PUBLIC),
}
# read in global passenv settings
p = os.environ.get("TOX_TESTENV_PASSENV", None)
if p is not None:
env_values = [x for x in p.split() if x]
value.extend(env_values)
# we ensure that tmp directory settings are passed on
# we could also set it to the per-venv "envtmpdir"
# but this leads to very long paths when run with jenkins
# so we just pass it on by default for now.
if tox.INFO.IS_WIN:
passenv.add("SYSTEMDRIVE") # needed for pip6
passenv.add("SYSTEMROOT") # needed for python's crypto module
passenv.add("PATHEXT") # needed for discovering executables
passenv.add("COMSPEC") # needed for distutils cygwincompiler
passenv.add("TEMP")
passenv.add("TMP")
# for `multiprocessing.cpu_count()` on Windows (prior to Python 3.4).
passenv.add("NUMBER_OF_PROCESSORS")
passenv.add("PROCESSOR_ARCHITECTURE") # platform.machine()
passenv.add("USERPROFILE") # needed for `os.path.expanduser()`
passenv.add("MSYSTEM") # fixes #429
else:
passenv.add("TMPDIR")
for spec in value:
for name in os.environ:
if fnmatchcase(name.upper(), spec.upper()):
passenv.add(name)
return passenv
parser.add_testenv_attribute(
name="passenv",
type="line-list",
postprocess=passenv,
help="environment variables needed during executing test commands (taken from invocation "
"environment). Note that tox always passes through some basic environment variables "
"which are needed for basic functioning of the Python system. See --showconfig for the "
"eventual passenv setting.",
)
parser.add_testenv_attribute(
name="whitelist_externals",
type="line-list",
help="each lines specifies a path or basename for which tox will not warn "
"about it coming from outside the test environment.",
)
parser.add_testenv_attribute(
name="platform",
type="string",
default=".*",
help="regular expression which must match against ``sys.platform``. "
"otherwise testenv will be skipped.",
)
def sitepackages(testenv_config, value):
return testenv_config.config.option.sitepackages or value
def alwayscopy(testenv_config, value):
return testenv_config.config.option.alwayscopy or value
parser.add_testenv_attribute(
name="sitepackages",
type="bool",
default=False,
postprocess=sitepackages,
help="Set to ``True`` if you want to create virtual environments that also "
"have access to globally installed packages.",
)
parser.add_testenv_attribute(
"download",
type="bool",
default=False,
help="download the latest pip, setuptools and wheel when creating the virtual"
"environment (default is to use the one bundled in virtualenv)",
)
parser.add_testenv_attribute(
name="alwayscopy",
type="bool",
default=False,
postprocess=alwayscopy,
help="Set to ``True`` if you want virtualenv to always copy files rather "
"than symlinking.",
)
def pip_pre(testenv_config, value):
return testenv_config.config.option.pre or value
parser.add_testenv_attribute(
name="pip_pre",
type="bool",
default=False,
postprocess=pip_pre,
help="If ``True``, adds ``--pre`` to the ``opts`` passed to the install command. ",
)
def develop(testenv_config, value):
option = testenv_config.config.option
return not option.installpkg and (
value or option.develop or option.devenv is not None
)
parser.add_testenv_attribute(
name="usedevelop",
type="bool",
postprocess=develop,
default=False,
help="install package in develop/editable mode",
)
parser.add_testenv_attribute_obj(InstallcmdOption())
parser.add_testenv_attribute(
name="list_dependencies_command",
type="argv",
default="python -m pip freeze",
help="list dependencies for a virtual environment",
)
parser.add_testenv_attribute_obj(DepOption())
parser.add_testenv_attribute(
name="commands",
type="argvlist",
default="",
help="each line specifies a test command and can use substitution.",
)
parser.add_testenv_attribute(
name="commands_pre",
type="argvlist",
default="",
help="each line specifies a setup command action and can use substitution.",
)
parser.add_testenv_attribute(
name="commands_post",
type="argvlist",
default="",
help="each line specifies a teardown command and can use substitution.",
)
parser.add_testenv_attribute(
"ignore_outcome",
type="bool",
default=False,
help="if set to True a failing result of this testenv will not make "
"tox fail, only a warning will be produced",
)
parser.add_testenv_attribute(
"extras",
type="line-list",
help="list of extras to install with the source distribution or develop install",
)
add_parallel_config(parser)
|
def tox_addoption(parser):
parser.add_argument(
"--version", action="store_true", help="report version information to stdout."
)
parser.add_argument(
"-h", "--help", action="store_true", help="show help about options"
)
parser.add_argument(
"--help-ini",
"--hi",
action="store_true",
dest="helpini",
help="show help about ini-names",
)
add_verbosity_commands(parser)
parser.add_argument(
"--showconfig",
action="store_true",
help="show live configuration (by default all env, with -l only default targets,"
" specific via TOXENV/-e)",
)
parser.add_argument(
"-l",
"--listenvs",
action="store_true",
help="show list of test environments (with description if verbose)",
)
parser.add_argument(
"-a",
"--listenvs-all",
action="store_true",
help="show list of all defined environments (with description if verbose)",
)
parser.add_argument(
"-c",
dest="configfile",
help="config file name or directory with 'tox.ini' file.",
)
parser.add_argument(
"-e",
action="append",
dest="env",
metavar="envlist",
help="work against specified environments (ALL selects all).",
)
parser.add_argument(
"--devenv",
metavar="ENVDIR",
help=(
"sets up a development environment at ENVDIR based on the env's tox "
"configuration specified by `-e` (-e defaults to py)."
),
)
parser.add_argument(
"--notest", action="store_true", help="skip invoking test commands."
)
parser.add_argument(
"--sdistonly",
action="store_true",
help="only perform the sdist packaging activity.",
)
add_parallel_flags(parser)
parser.add_argument(
"--parallel--safe-build",
action="store_true",
dest="parallel_safe_build",
help="(deprecated) ensure two tox builds can run in parallel "
"(uses a lock file in the tox workdir with .lock extension)",
)
parser.add_argument(
"--installpkg",
metavar="PATH",
help="use specified package for installation into venv, instead of creating an sdist.",
)
parser.add_argument(
"--develop",
action="store_true",
help="install package in the venv using 'setup.py develop' via 'pip -e .'",
)
parser.add_argument(
"-i",
"--index-url",
action="append",
dest="indexurl",
metavar="URL",
help="set indexserver url (if URL is of form name=url set the "
"url for the 'name' indexserver, specifically)",
)
parser.add_argument(
"--pre",
action="store_true",
help="install pre-releases and development versions of dependencies. "
"This will pass the --pre option to install_command "
"(pip by default).",
)
parser.add_argument(
"-r",
"--recreate",
action="store_true",
help="force recreation of virtual environments",
)
parser.add_argument(
"--result-json",
dest="resultjson",
metavar="PATH",
help="write a json file with detailed information "
"about all commands and results involved.",
)
# We choose 1 to 4294967295 because it is the range of PYTHONHASHSEED.
parser.add_argument(
"--hashseed",
metavar="SEED",
help="set PYTHONHASHSEED to SEED before running commands. "
"Defaults to a random integer in the range [1, 4294967295] "
"([1, 1024] on Windows). "
"Passing 'noset' suppresses this behavior.",
)
parser.add_argument(
"--force-dep",
action="append",
metavar="REQ",
help="Forces a certain version of one of the dependencies "
"when configuring the virtual environment. REQ Examples "
"'pytest<2.7' or 'django>=1.6'.",
)
parser.add_argument(
"--sitepackages",
action="store_true",
help="override sitepackages setting to True in all envs",
)
parser.add_argument(
"--alwayscopy",
action="store_true",
help="override alwayscopy setting to True in all envs",
)
cli_skip_missing_interpreter(parser)
parser.add_argument("--workdir", metavar="PATH", help="tox working directory")
parser.add_argument(
"args",
nargs="*",
help="additional arguments available to command positional substitution",
)
def _set_envdir_from_devenv(testenv_config, value):
if testenv_config.config.option.devenv is not None:
return py.path.local(testenv_config.config.option.devenv)
else:
return value
parser.add_testenv_attribute(
name="envdir",
type="path",
default="{toxworkdir}/{envname}",
help="set venv directory -- be very careful when changing this as tox "
"will remove this directory when recreating an environment",
postprocess=_set_envdir_from_devenv,
)
# add various core venv interpreter attributes
def setenv(testenv_config, value):
setenv = value
config = testenv_config.config
if "PYTHONHASHSEED" not in setenv and config.hashseed is not None:
setenv["PYTHONHASHSEED"] = config.hashseed
setenv["TOX_ENV_NAME"] = str(testenv_config.envname)
setenv["TOX_ENV_DIR"] = str(testenv_config.envdir)
return setenv
parser.add_testenv_attribute(
name="setenv",
type="dict_setenv",
postprocess=setenv,
help="list of X=Y lines with environment variable settings",
)
def basepython_default(testenv_config, value):
"""either user set or proposed from the factor name
in both cases we check that the factor name implied python version and the resolved
python interpreter version match up; if they don't we warn, unless ignore base
python conflict is set in which case the factor name implied version if forced
"""
for factor in testenv_config.factors:
match = tox.PYTHON.PY_FACTORS_RE.match(factor)
if match:
base_exe = {"py": "python"}.get(match.group(1), match.group(1))
version_s = match.group(2)
if not version_s:
version_info = ()
elif len(version_s) == 1:
version_info = (version_s,)
else:
version_info = (version_s[0], version_s[1:])
implied_version = ".".join(version_info)
implied_python = "{}{}".format(base_exe, implied_version)
break
else:
implied_python, version_info, implied_version = None, (), ""
if (
testenv_config.config.ignore_basepython_conflict
and implied_python is not None
):
return implied_python
proposed_python = (
(implied_python or sys.executable) if value is None else str(value)
)
if implied_python is not None and implied_python != proposed_python:
testenv_config.basepython = proposed_python
python_info_for_proposed = testenv_config.python_info
if not isinstance(python_info_for_proposed, NoInterpreterInfo):
proposed_version = ".".join(
str(x)
for x in python_info_for_proposed.version_info[: len(version_info)]
)
if proposed_version != implied_version:
# TODO(stephenfin): Raise an exception here in tox 4.0
warnings.warn(
"conflicting basepython version (set {}, should be {}) for env '{}';"
"resolve conflict or set ignore_basepython_conflict".format(
proposed_version, implied_version, testenv_config.envname
)
)
return proposed_python
parser.add_testenv_attribute(
name="basepython",
type="basepython",
default=None,
postprocess=basepython_default,
help="executable name or path of interpreter used to create a virtual test environment.",
)
def merge_description(testenv_config, value):
"""the reader by default joins generated description with new line,
replace new line with space"""
return value.replace("\n", " ")
parser.add_testenv_attribute(
name="description",
type="string",
default="",
postprocess=merge_description,
help="short description of this environment",
)
parser.add_testenv_attribute(
name="envtmpdir",
type="path",
default="{envdir}/tmp",
help="venv temporary directory",
)
parser.add_testenv_attribute(
name="envlogdir", type="path", default="{envdir}/log", help="venv log directory"
)
parser.add_testenv_attribute(
name="downloadcache",
type="string",
default=None,
help="(ignored) has no effect anymore, pip-8 uses local caching by default",
)
parser.add_testenv_attribute(
name="changedir",
type="path",
default="{toxinidir}",
help="directory to change to when running commands",
)
parser.add_testenv_attribute_obj(PosargsOption())
parser.add_testenv_attribute(
name="skip_install",
type="bool",
default=False,
help="Do not install the current package. This can be used when you need the virtualenv "
"management but do not want to install the current package",
)
parser.add_testenv_attribute(
name="ignore_errors",
type="bool",
default=False,
help="if set to True all commands will be executed irrespective of their result error "
"status.",
)
def recreate(testenv_config, value):
if testenv_config.config.option.recreate:
return True
return value
parser.add_testenv_attribute(
name="recreate",
type="bool",
default=False,
postprocess=recreate,
help="always recreate this test environment.",
)
def passenv(testenv_config, value):
# Flatten the list to deal with space-separated values.
value = list(itertools.chain.from_iterable([x.split(" ") for x in value]))
passenv = {
"PATH",
"PIP_INDEX_URL",
"LANG",
"LANGUAGE",
"LD_LIBRARY_PATH",
"TOX_WORK_DIR",
str(REPORTER_TIMESTAMP_ON_ENV),
str(PARALLEL_ENV_VAR_KEY),
}
# read in global passenv settings
p = os.environ.get("TOX_TESTENV_PASSENV", None)
if p is not None:
env_values = [x for x in p.split() if x]
value.extend(env_values)
# we ensure that tmp directory settings are passed on
# we could also set it to the per-venv "envtmpdir"
# but this leads to very long paths when run with jenkins
# so we just pass it on by default for now.
if tox.INFO.IS_WIN:
passenv.add("SYSTEMDRIVE") # needed for pip6
passenv.add("SYSTEMROOT") # needed for python's crypto module
passenv.add("PATHEXT") # needed for discovering executables
passenv.add("COMSPEC") # needed for distutils cygwincompiler
passenv.add("TEMP")
passenv.add("TMP")
# for `multiprocessing.cpu_count()` on Windows (prior to Python 3.4).
passenv.add("NUMBER_OF_PROCESSORS")
passenv.add("PROCESSOR_ARCHITECTURE") # platform.machine()
passenv.add("USERPROFILE") # needed for `os.path.expanduser()`
passenv.add("MSYSTEM") # fixes #429
else:
passenv.add("TMPDIR")
for spec in value:
for name in os.environ:
if fnmatchcase(name.upper(), spec.upper()):
passenv.add(name)
return passenv
parser.add_testenv_attribute(
name="passenv",
type="line-list",
postprocess=passenv,
help="environment variables needed during executing test commands (taken from invocation "
"environment). Note that tox always passes through some basic environment variables "
"which are needed for basic functioning of the Python system. See --showconfig for the "
"eventual passenv setting.",
)
parser.add_testenv_attribute(
name="whitelist_externals",
type="line-list",
help="each lines specifies a path or basename for which tox will not warn "
"about it coming from outside the test environment.",
)
parser.add_testenv_attribute(
name="platform",
type="string",
default=".*",
help="regular expression which must match against ``sys.platform``. "
"otherwise testenv will be skipped.",
)
def sitepackages(testenv_config, value):
return testenv_config.config.option.sitepackages or value
def alwayscopy(testenv_config, value):
return testenv_config.config.option.alwayscopy or value
parser.add_testenv_attribute(
name="sitepackages",
type="bool",
default=False,
postprocess=sitepackages,
help="Set to ``True`` if you want to create virtual environments that also "
"have access to globally installed packages.",
)
parser.add_testenv_attribute(
"download",
type="bool",
default=False,
help="download the latest pip, setuptools and wheel when creating the virtual"
"environment (default is to use the one bundled in virtualenv)",
)
parser.add_testenv_attribute(
name="alwayscopy",
type="bool",
default=False,
postprocess=alwayscopy,
help="Set to ``True`` if you want virtualenv to always copy files rather "
"than symlinking.",
)
def pip_pre(testenv_config, value):
return testenv_config.config.option.pre or value
parser.add_testenv_attribute(
name="pip_pre",
type="bool",
default=False,
postprocess=pip_pre,
help="If ``True``, adds ``--pre`` to the ``opts`` passed to the install command. ",
)
def develop(testenv_config, value):
option = testenv_config.config.option
return not option.installpkg and (
value or option.develop or option.devenv is not None
)
parser.add_testenv_attribute(
name="usedevelop",
type="bool",
postprocess=develop,
default=False,
help="install package in develop/editable mode",
)
parser.add_testenv_attribute_obj(InstallcmdOption())
parser.add_testenv_attribute(
name="list_dependencies_command",
type="argv",
default="python -m pip freeze",
help="list dependencies for a virtual environment",
)
parser.add_testenv_attribute_obj(DepOption())
parser.add_testenv_attribute(
name="commands",
type="argvlist",
default="",
help="each line specifies a test command and can use substitution.",
)
parser.add_testenv_attribute(
name="commands_pre",
type="argvlist",
default="",
help="each line specifies a setup command action and can use substitution.",
)
parser.add_testenv_attribute(
name="commands_post",
type="argvlist",
default="",
help="each line specifies a teardown command and can use substitution.",
)
parser.add_testenv_attribute(
"ignore_outcome",
type="bool",
default=False,
help="if set to True a failing result of this testenv will not make "
"tox fail, only a warning will be produced",
)
parser.add_testenv_attribute(
"extras",
type="line-list",
help="list of extras to install with the source distribution or develop install",
)
add_parallel_config(parser)
|
https://github.com/tox-dev/tox/issues/1444
|
$ tox -p all
β Έ [3] py36 | py37 | py38ERROR: invocation failed (exit code 1), logfile: /home/churchyard/tmp/totox/.tox/py37/log/py37-5.log
=================================================== log start ===================================================
py37 run-test-pre: PYTHONHASHSEED='1114882869'
py37 run-test: commands[0] | python runner.py
py37 run-test-pre: PYTHONHASHSEED='3136963143'
py37 run-test: commands[0] | python -c 'import sys; print(sys.version)'
3.7.5 (default, Oct 17 2019, 12:09:47)
[GCC 9.2.1 20190827 (Red Hat 9.2.1-1)]
Traceback (most recent call last):
File "runner.py", line 8, in <module>
assert 'py36' in cp.stdout
AssertionError
ERROR: InvocationError for command /home/churchyard/tmp/totox/.tox/py37/bin/python runner.py (exited with code 1)
==================================================== log end ====================================================
β FAIL py37 in 1.389 seconds
β ΄ [2] py36 | py38ERROR: invocation failed (exit code 1), logfile: /home/churchyard/tmp/totox/.tox/py38/log/py38-5.log
=================================================== log start ===================================================
py38 run-test-pre: PYTHONHASHSEED='3502501543'
py38 run-test: commands[0] | python runner.py
py38 run-test-pre: PYTHONHASHSEED='1953872060'
py38 run-test: commands[0] | python -c 'import sys; print(sys.version)'
3.8.0 (default, Oct 16 2019, 12:47:36)
[GCC 9.2.1 20190827 (Red Hat 9.2.1-1)]
Traceback (most recent call last):
File "runner.py", line 8, in <module>
assert 'py36' in cp.stdout
AssertionError
ERROR: InvocationError for command /home/churchyard/tmp/totox/.tox/py38/bin/python runner.py (exited with code 1)
==================================================== log end ====================================================
β FAIL py38 in 1.536 seconds
β [1] py36ERROR: invocation failed (exit code 1), logfile: /home/churchyard/tmp/totox/.tox/py36/log/py36-5.log
=================================================== log start ===================================================
py36 run-test-pre: PYTHONHASHSEED='664963699'
py36 run-test: commands[0] | python runner.py
py36 recreate: /home/churchyard/tmp/totox/inner/.tox/py36
py36 run-test-pre: PYTHONHASHSEED='4138548204'
py36 run-test: commands[0] | python -c 'import sys; print(sys.version)'
3.6.9 (default, Jul 3 2019, 15:08:07)
[GCC 9.1.1 20190503 (Red Hat 9.1.1-1)]
Traceback (most recent call last):
File "runner.py", line 9, in <module>
assert 'py37' in cp.stdout
AssertionError
ERROR: InvocationError for command /home/churchyard/tmp/totox/.tox/py36/bin/python runner.py (exited with code 1)
==================================================== log end ====================================================
β FAIL py36 in 4.851 seconds
____________________________________________________ summary ____________________________________________________
ERROR: py36: parallel child exit code 1
ERROR: py37: parallel child exit code 1
ERROR: py38: parallel child exit code 1
|
AssertionError
|
def passenv(testenv_config, value):
# Flatten the list to deal with space-separated values.
value = list(itertools.chain.from_iterable([x.split(" ") for x in value]))
passenv = {
"PATH",
"PIP_INDEX_URL",
"LANG",
"LANGUAGE",
"LD_LIBRARY_PATH",
"TOX_WORK_DIR",
str(REPORTER_TIMESTAMP_ON_ENV),
str(PARALLEL_ENV_VAR_KEY_PUBLIC),
}
# read in global passenv settings
p = os.environ.get("TOX_TESTENV_PASSENV", None)
if p is not None:
env_values = [x for x in p.split() if x]
value.extend(env_values)
# we ensure that tmp directory settings are passed on
# we could also set it to the per-venv "envtmpdir"
# but this leads to very long paths when run with jenkins
# so we just pass it on by default for now.
if tox.INFO.IS_WIN:
passenv.add("SYSTEMDRIVE") # needed for pip6
passenv.add("SYSTEMROOT") # needed for python's crypto module
passenv.add("PATHEXT") # needed for discovering executables
passenv.add("COMSPEC") # needed for distutils cygwincompiler
passenv.add("TEMP")
passenv.add("TMP")
# for `multiprocessing.cpu_count()` on Windows (prior to Python 3.4).
passenv.add("NUMBER_OF_PROCESSORS")
passenv.add("PROCESSOR_ARCHITECTURE") # platform.machine()
passenv.add("USERPROFILE") # needed for `os.path.expanduser()`
passenv.add("MSYSTEM") # fixes #429
else:
passenv.add("TMPDIR")
for spec in value:
for name in os.environ:
if fnmatchcase(name.upper(), spec.upper()):
passenv.add(name)
return passenv
|
def passenv(testenv_config, value):
# Flatten the list to deal with space-separated values.
value = list(itertools.chain.from_iterable([x.split(" ") for x in value]))
passenv = {
"PATH",
"PIP_INDEX_URL",
"LANG",
"LANGUAGE",
"LD_LIBRARY_PATH",
"TOX_WORK_DIR",
str(REPORTER_TIMESTAMP_ON_ENV),
str(PARALLEL_ENV_VAR_KEY),
}
# read in global passenv settings
p = os.environ.get("TOX_TESTENV_PASSENV", None)
if p is not None:
env_values = [x for x in p.split() if x]
value.extend(env_values)
# we ensure that tmp directory settings are passed on
# we could also set it to the per-venv "envtmpdir"
# but this leads to very long paths when run with jenkins
# so we just pass it on by default for now.
if tox.INFO.IS_WIN:
passenv.add("SYSTEMDRIVE") # needed for pip6
passenv.add("SYSTEMROOT") # needed for python's crypto module
passenv.add("PATHEXT") # needed for discovering executables
passenv.add("COMSPEC") # needed for distutils cygwincompiler
passenv.add("TEMP")
passenv.add("TMP")
# for `multiprocessing.cpu_count()` on Windows (prior to Python 3.4).
passenv.add("NUMBER_OF_PROCESSORS")
passenv.add("PROCESSOR_ARCHITECTURE") # platform.machine()
passenv.add("USERPROFILE") # needed for `os.path.expanduser()`
passenv.add("MSYSTEM") # fixes #429
else:
passenv.add("TMPDIR")
for spec in value:
for name in os.environ:
if fnmatchcase(name.upper(), spec.upper()):
passenv.add(name)
return passenv
|
https://github.com/tox-dev/tox/issues/1444
|
$ tox -p all
β Έ [3] py36 | py37 | py38ERROR: invocation failed (exit code 1), logfile: /home/churchyard/tmp/totox/.tox/py37/log/py37-5.log
=================================================== log start ===================================================
py37 run-test-pre: PYTHONHASHSEED='1114882869'
py37 run-test: commands[0] | python runner.py
py37 run-test-pre: PYTHONHASHSEED='3136963143'
py37 run-test: commands[0] | python -c 'import sys; print(sys.version)'
3.7.5 (default, Oct 17 2019, 12:09:47)
[GCC 9.2.1 20190827 (Red Hat 9.2.1-1)]
Traceback (most recent call last):
File "runner.py", line 8, in <module>
assert 'py36' in cp.stdout
AssertionError
ERROR: InvocationError for command /home/churchyard/tmp/totox/.tox/py37/bin/python runner.py (exited with code 1)
==================================================== log end ====================================================
β FAIL py37 in 1.389 seconds
β ΄ [2] py36 | py38ERROR: invocation failed (exit code 1), logfile: /home/churchyard/tmp/totox/.tox/py38/log/py38-5.log
=================================================== log start ===================================================
py38 run-test-pre: PYTHONHASHSEED='3502501543'
py38 run-test: commands[0] | python runner.py
py38 run-test-pre: PYTHONHASHSEED='1953872060'
py38 run-test: commands[0] | python -c 'import sys; print(sys.version)'
3.8.0 (default, Oct 16 2019, 12:47:36)
[GCC 9.2.1 20190827 (Red Hat 9.2.1-1)]
Traceback (most recent call last):
File "runner.py", line 8, in <module>
assert 'py36' in cp.stdout
AssertionError
ERROR: InvocationError for command /home/churchyard/tmp/totox/.tox/py38/bin/python runner.py (exited with code 1)
==================================================== log end ====================================================
β FAIL py38 in 1.536 seconds
β [1] py36ERROR: invocation failed (exit code 1), logfile: /home/churchyard/tmp/totox/.tox/py36/log/py36-5.log
=================================================== log start ===================================================
py36 run-test-pre: PYTHONHASHSEED='664963699'
py36 run-test: commands[0] | python runner.py
py36 recreate: /home/churchyard/tmp/totox/inner/.tox/py36
py36 run-test-pre: PYTHONHASHSEED='4138548204'
py36 run-test: commands[0] | python -c 'import sys; print(sys.version)'
3.6.9 (default, Jul 3 2019, 15:08:07)
[GCC 9.1.1 20190503 (Red Hat 9.1.1-1)]
Traceback (most recent call last):
File "runner.py", line 9, in <module>
assert 'py37' in cp.stdout
AssertionError
ERROR: InvocationError for command /home/churchyard/tmp/totox/.tox/py36/bin/python runner.py (exited with code 1)
==================================================== log end ====================================================
β FAIL py36 in 4.851 seconds
____________________________________________________ summary ____________________________________________________
ERROR: py36: parallel child exit code 1
ERROR: py37: parallel child exit code 1
ERROR: py38: parallel child exit code 1
|
AssertionError
|
def __init__(self, config, ini_path, ini_data): # noqa
config.toxinipath = ini_path
using("tox.ini: {} (pid {})".format(config.toxinipath, os.getpid()))
config.toxinidir = config.toxinipath.dirpath()
self._cfg = py.iniconfig.IniConfig(config.toxinipath, ini_data)
previous_line_of = self._cfg.lineof
def line_of_default_to_zero(section, name=None):
at = previous_line_of(section, name=name)
if at is None:
at = 0
return at
self._cfg.lineof = line_of_default_to_zero
config._cfg = self._cfg
self.config = config
prefix = "tox" if ini_path.basename == "setup.cfg" else None
context_name = getcontextname()
if context_name == "jenkins":
reader = SectionReader(
"tox:jenkins", self._cfg, prefix=prefix, fallbacksections=["tox"]
)
dist_share_default = "{toxworkdir}/distshare"
elif not context_name:
reader = SectionReader("tox", self._cfg, prefix=prefix)
dist_share_default = "{homedir}/.tox/distshare"
else:
raise ValueError("invalid context")
if config.option.hashseed is None:
hash_seed = make_hashseed()
elif config.option.hashseed == "noset":
hash_seed = None
else:
hash_seed = config.option.hashseed
config.hashseed = hash_seed
reader.addsubstitutions(toxinidir=config.toxinidir, homedir=config.homedir)
if config.option.workdir is None:
config.toxworkdir = reader.getpath("toxworkdir", "{toxinidir}/.tox")
else:
config.toxworkdir = config.toxinidir.join(config.option.workdir, abs=True)
if os.path.exists(str(config.toxworkdir)):
config.toxworkdir = config.toxworkdir.realpath()
reader.addsubstitutions(toxworkdir=config.toxworkdir)
config.ignore_basepython_conflict = reader.getbool(
"ignore_basepython_conflict", False
)
config.distdir = reader.getpath("distdir", "{toxworkdir}/dist")
reader.addsubstitutions(distdir=config.distdir)
config.distshare = reader.getpath("distshare", dist_share_default)
config.temp_dir = reader.getpath("temp_dir", "{toxworkdir}/.tmp")
reader.addsubstitutions(distshare=config.distshare)
config.sdistsrc = reader.getpath("sdistsrc", None)
config.setupdir = reader.getpath("setupdir", "{toxinidir}")
config.logdir = config.toxworkdir.join("log")
within_parallel = PARALLEL_ENV_VAR_KEY_PRIVATE in os.environ
if not within_parallel and not WITHIN_PROVISION:
ensure_empty_dir(config.logdir)
# determine indexserver dictionary
config.indexserver = {"default": IndexServerConfig("default")}
prefix = "indexserver"
for line in reader.getlist(prefix):
name, url = map(lambda x: x.strip(), line.split("=", 1))
config.indexserver[name] = IndexServerConfig(name, url)
if config.option.skip_missing_interpreters == "config":
val = reader.getbool("skip_missing_interpreters", False)
config.option.skip_missing_interpreters = "true" if val else "false"
override = False
if config.option.indexurl:
for url_def in config.option.indexurl:
m = re.match(r"\W*(\w+)=(\S+)", url_def)
if m is None:
url = url_def
name = "default"
else:
name, url = m.groups()
if not url:
url = None
if name != "ALL":
config.indexserver[name].url = url
else:
override = url
# let ALL override all existing entries
if override:
for name in config.indexserver:
config.indexserver[name] = IndexServerConfig(name, override)
self.handle_provision(config, reader)
self.parse_build_isolation(config, reader)
res = self._getenvdata(reader, config)
config.envlist, all_envs, config.envlist_default, config.envlist_explicit = res
# factors used in config or predefined
known_factors = self._list_section_factors("testenv")
known_factors.update({"py", "python"})
# factors stated in config envlist
stated_envlist = reader.getstring("envlist", replace=False)
if stated_envlist:
for env in _split_env(stated_envlist):
known_factors.update(env.split("-"))
# configure testenvs
to_do = []
failures = OrderedDict()
results = {}
cur_self = self
def run(name, section, subs, config):
try:
results[name] = cur_self.make_envconfig(name, section, subs, config)
except Exception as exception:
failures[name] = (exception, traceback.format_exc())
order = []
for name in all_envs:
section = "{}{}".format(testenvprefix, name)
factors = set(name.split("-"))
if (
section in self._cfg
or factors <= known_factors
or all(
tox.PYTHON.PY_FACTORS_RE.match(factor)
for factor in factors - known_factors
)
):
order.append(name)
thread = Thread(target=run, args=(name, section, reader._subs, config))
thread.daemon = True
thread.start()
to_do.append(thread)
for thread in to_do:
while thread.is_alive():
thread.join(timeout=20)
if failures:
raise tox.exception.ConfigError(
"\n".join(
"{} failed with {} at {}".format(key, exc, trace)
for key, (exc, trace) in failures.items()
)
)
for name in order:
config.envconfigs[name] = results[name]
all_develop = all(
name in config.envconfigs and config.envconfigs[name].usedevelop
for name in config.envlist
)
config.skipsdist = reader.getbool("skipsdist", all_develop)
if config.option.devenv is not None:
config.option.notest = True
if config.option.devenv is not None and len(config.envlist) != 1:
feedback("--devenv requires only a single -e", sysexit=True)
|
def __init__(self, config, ini_path, ini_data): # noqa
config.toxinipath = ini_path
using("tox.ini: {} (pid {})".format(config.toxinipath, os.getpid()))
config.toxinidir = config.toxinipath.dirpath()
self._cfg = py.iniconfig.IniConfig(config.toxinipath, ini_data)
previous_line_of = self._cfg.lineof
def line_of_default_to_zero(section, name=None):
at = previous_line_of(section, name=name)
if at is None:
at = 0
return at
self._cfg.lineof = line_of_default_to_zero
config._cfg = self._cfg
self.config = config
prefix = "tox" if ini_path.basename == "setup.cfg" else None
context_name = getcontextname()
if context_name == "jenkins":
reader = SectionReader(
"tox:jenkins", self._cfg, prefix=prefix, fallbacksections=["tox"]
)
dist_share_default = "{toxworkdir}/distshare"
elif not context_name:
reader = SectionReader("tox", self._cfg, prefix=prefix)
dist_share_default = "{homedir}/.tox/distshare"
else:
raise ValueError("invalid context")
if config.option.hashseed is None:
hash_seed = make_hashseed()
elif config.option.hashseed == "noset":
hash_seed = None
else:
hash_seed = config.option.hashseed
config.hashseed = hash_seed
reader.addsubstitutions(toxinidir=config.toxinidir, homedir=config.homedir)
if config.option.workdir is None:
config.toxworkdir = reader.getpath("toxworkdir", "{toxinidir}/.tox")
else:
config.toxworkdir = config.toxinidir.join(config.option.workdir, abs=True)
if os.path.exists(str(config.toxworkdir)):
config.toxworkdir = config.toxworkdir.realpath()
reader.addsubstitutions(toxworkdir=config.toxworkdir)
config.ignore_basepython_conflict = reader.getbool(
"ignore_basepython_conflict", False
)
config.distdir = reader.getpath("distdir", "{toxworkdir}/dist")
reader.addsubstitutions(distdir=config.distdir)
config.distshare = reader.getpath("distshare", dist_share_default)
config.temp_dir = reader.getpath("temp_dir", "{toxworkdir}/.tmp")
reader.addsubstitutions(distshare=config.distshare)
config.sdistsrc = reader.getpath("sdistsrc", None)
config.setupdir = reader.getpath("setupdir", "{toxinidir}")
config.logdir = config.toxworkdir.join("log")
within_parallel = PARALLEL_ENV_VAR_KEY in os.environ
if not within_parallel and not WITHIN_PROVISION:
ensure_empty_dir(config.logdir)
# determine indexserver dictionary
config.indexserver = {"default": IndexServerConfig("default")}
prefix = "indexserver"
for line in reader.getlist(prefix):
name, url = map(lambda x: x.strip(), line.split("=", 1))
config.indexserver[name] = IndexServerConfig(name, url)
if config.option.skip_missing_interpreters == "config":
val = reader.getbool("skip_missing_interpreters", False)
config.option.skip_missing_interpreters = "true" if val else "false"
override = False
if config.option.indexurl:
for url_def in config.option.indexurl:
m = re.match(r"\W*(\w+)=(\S+)", url_def)
if m is None:
url = url_def
name = "default"
else:
name, url = m.groups()
if not url:
url = None
if name != "ALL":
config.indexserver[name].url = url
else:
override = url
# let ALL override all existing entries
if override:
for name in config.indexserver:
config.indexserver[name] = IndexServerConfig(name, override)
self.handle_provision(config, reader)
self.parse_build_isolation(config, reader)
res = self._getenvdata(reader, config)
config.envlist, all_envs, config.envlist_default, config.envlist_explicit = res
# factors used in config or predefined
known_factors = self._list_section_factors("testenv")
known_factors.update({"py", "python"})
# factors stated in config envlist
stated_envlist = reader.getstring("envlist", replace=False)
if stated_envlist:
for env in _split_env(stated_envlist):
known_factors.update(env.split("-"))
# configure testenvs
to_do = []
failures = OrderedDict()
results = {}
cur_self = self
def run(name, section, subs, config):
try:
results[name] = cur_self.make_envconfig(name, section, subs, config)
except Exception as exception:
failures[name] = (exception, traceback.format_exc())
order = []
for name in all_envs:
section = "{}{}".format(testenvprefix, name)
factors = set(name.split("-"))
if (
section in self._cfg
or factors <= known_factors
or all(
tox.PYTHON.PY_FACTORS_RE.match(factor)
for factor in factors - known_factors
)
):
order.append(name)
thread = Thread(target=run, args=(name, section, reader._subs, config))
thread.daemon = True
thread.start()
to_do.append(thread)
for thread in to_do:
while thread.is_alive():
thread.join(timeout=20)
if failures:
raise tox.exception.ConfigError(
"\n".join(
"{} failed with {} at {}".format(key, exc, trace)
for key, (exc, trace) in failures.items()
)
)
for name in order:
config.envconfigs[name] = results[name]
all_develop = all(
name in config.envconfigs and config.envconfigs[name].usedevelop
for name in config.envlist
)
config.skipsdist = reader.getbool("skipsdist", all_develop)
if config.option.devenv is not None:
config.option.notest = True
if config.option.devenv is not None and len(config.envlist) != 1:
feedback("--devenv requires only a single -e", sysexit=True)
|
https://github.com/tox-dev/tox/issues/1444
|
$ tox -p all
β Έ [3] py36 | py37 | py38ERROR: invocation failed (exit code 1), logfile: /home/churchyard/tmp/totox/.tox/py37/log/py37-5.log
=================================================== log start ===================================================
py37 run-test-pre: PYTHONHASHSEED='1114882869'
py37 run-test: commands[0] | python runner.py
py37 run-test-pre: PYTHONHASHSEED='3136963143'
py37 run-test: commands[0] | python -c 'import sys; print(sys.version)'
3.7.5 (default, Oct 17 2019, 12:09:47)
[GCC 9.2.1 20190827 (Red Hat 9.2.1-1)]
Traceback (most recent call last):
File "runner.py", line 8, in <module>
assert 'py36' in cp.stdout
AssertionError
ERROR: InvocationError for command /home/churchyard/tmp/totox/.tox/py37/bin/python runner.py (exited with code 1)
==================================================== log end ====================================================
β FAIL py37 in 1.389 seconds
β ΄ [2] py36 | py38ERROR: invocation failed (exit code 1), logfile: /home/churchyard/tmp/totox/.tox/py38/log/py38-5.log
=================================================== log start ===================================================
py38 run-test-pre: PYTHONHASHSEED='3502501543'
py38 run-test: commands[0] | python runner.py
py38 run-test-pre: PYTHONHASHSEED='1953872060'
py38 run-test: commands[0] | python -c 'import sys; print(sys.version)'
3.8.0 (default, Oct 16 2019, 12:47:36)
[GCC 9.2.1 20190827 (Red Hat 9.2.1-1)]
Traceback (most recent call last):
File "runner.py", line 8, in <module>
assert 'py36' in cp.stdout
AssertionError
ERROR: InvocationError for command /home/churchyard/tmp/totox/.tox/py38/bin/python runner.py (exited with code 1)
==================================================== log end ====================================================
β FAIL py38 in 1.536 seconds
β [1] py36ERROR: invocation failed (exit code 1), logfile: /home/churchyard/tmp/totox/.tox/py36/log/py36-5.log
=================================================== log start ===================================================
py36 run-test-pre: PYTHONHASHSEED='664963699'
py36 run-test: commands[0] | python runner.py
py36 recreate: /home/churchyard/tmp/totox/inner/.tox/py36
py36 run-test-pre: PYTHONHASHSEED='4138548204'
py36 run-test: commands[0] | python -c 'import sys; print(sys.version)'
3.6.9 (default, Jul 3 2019, 15:08:07)
[GCC 9.1.1 20190503 (Red Hat 9.1.1-1)]
Traceback (most recent call last):
File "runner.py", line 9, in <module>
assert 'py37' in cp.stdout
AssertionError
ERROR: InvocationError for command /home/churchyard/tmp/totox/.tox/py36/bin/python runner.py (exited with code 1)
==================================================== log end ====================================================
β FAIL py36 in 4.851 seconds
____________________________________________________ summary ____________________________________________________
ERROR: py36: parallel child exit code 1
ERROR: py37: parallel child exit code 1
ERROR: py38: parallel child exit code 1
|
AssertionError
|
def _getenvdata(self, reader, config):
from_option = self.config.option.env
from_environ = os.environ.get("TOXENV")
from_config = reader.getstring("envlist", replace=False)
env_list = []
envlist_explicit = False
if (from_option and "ALL" in from_option) or (
not from_option and from_environ and "ALL" in from_environ.split(",")
):
all_envs = self._getallenvs(reader)
else:
candidates = (
(os.environ.get(PARALLEL_ENV_VAR_KEY_PRIVATE), True),
(from_option, True),
(from_environ, True),
("py" if self.config.option.devenv is not None else None, False),
(from_config, False),
)
env_str, envlist_explicit = next(
((i, e) for i, e in candidates if i), ([], False)
)
env_list = _split_env(env_str)
all_envs = self._getallenvs(reader, env_list)
if not env_list:
env_list = all_envs
package_env = config.isolated_build_env
if config.isolated_build is True and package_env in all_envs:
all_envs.remove(package_env)
if config.isolated_build is True and package_env in env_list:
msg = "isolated_build_env {} cannot be part of envlist".format(package_env)
raise tox.exception.ConfigError(msg)
return env_list, all_envs, _split_env(from_config), envlist_explicit
|
def _getenvdata(self, reader, config):
from_option = self.config.option.env
from_environ = os.environ.get("TOXENV")
from_config = reader.getstring("envlist", replace=False)
env_list = []
envlist_explicit = False
if (from_option and "ALL" in from_option) or (
not from_option and from_environ and "ALL" in from_environ.split(",")
):
all_envs = self._getallenvs(reader)
else:
candidates = (
(os.environ.get(PARALLEL_ENV_VAR_KEY), True),
(from_option, True),
(from_environ, True),
("py" if self.config.option.devenv is not None else None, False),
(from_config, False),
)
env_str, envlist_explicit = next(
((i, e) for i, e in candidates if i), ([], False)
)
env_list = _split_env(env_str)
all_envs = self._getallenvs(reader, env_list)
if not env_list:
env_list = all_envs
package_env = config.isolated_build_env
if config.isolated_build is True and package_env in all_envs:
all_envs.remove(package_env)
if config.isolated_build is True and package_env in env_list:
msg = "isolated_build_env {} cannot be part of envlist".format(package_env)
raise tox.exception.ConfigError(msg)
return env_list, all_envs, _split_env(from_config), envlist_explicit
|
https://github.com/tox-dev/tox/issues/1444
|
$ tox -p all
β Έ [3] py36 | py37 | py38ERROR: invocation failed (exit code 1), logfile: /home/churchyard/tmp/totox/.tox/py37/log/py37-5.log
=================================================== log start ===================================================
py37 run-test-pre: PYTHONHASHSEED='1114882869'
py37 run-test: commands[0] | python runner.py
py37 run-test-pre: PYTHONHASHSEED='3136963143'
py37 run-test: commands[0] | python -c 'import sys; print(sys.version)'
3.7.5 (default, Oct 17 2019, 12:09:47)
[GCC 9.2.1 20190827 (Red Hat 9.2.1-1)]
Traceback (most recent call last):
File "runner.py", line 8, in <module>
assert 'py36' in cp.stdout
AssertionError
ERROR: InvocationError for command /home/churchyard/tmp/totox/.tox/py37/bin/python runner.py (exited with code 1)
==================================================== log end ====================================================
β FAIL py37 in 1.389 seconds
β ΄ [2] py36 | py38ERROR: invocation failed (exit code 1), logfile: /home/churchyard/tmp/totox/.tox/py38/log/py38-5.log
=================================================== log start ===================================================
py38 run-test-pre: PYTHONHASHSEED='3502501543'
py38 run-test: commands[0] | python runner.py
py38 run-test-pre: PYTHONHASHSEED='1953872060'
py38 run-test: commands[0] | python -c 'import sys; print(sys.version)'
3.8.0 (default, Oct 16 2019, 12:47:36)
[GCC 9.2.1 20190827 (Red Hat 9.2.1-1)]
Traceback (most recent call last):
File "runner.py", line 8, in <module>
assert 'py36' in cp.stdout
AssertionError
ERROR: InvocationError for command /home/churchyard/tmp/totox/.tox/py38/bin/python runner.py (exited with code 1)
==================================================== log end ====================================================
β FAIL py38 in 1.536 seconds
β [1] py36ERROR: invocation failed (exit code 1), logfile: /home/churchyard/tmp/totox/.tox/py36/log/py36-5.log
=================================================== log start ===================================================
py36 run-test-pre: PYTHONHASHSEED='664963699'
py36 run-test: commands[0] | python runner.py
py36 recreate: /home/churchyard/tmp/totox/inner/.tox/py36
py36 run-test-pre: PYTHONHASHSEED='4138548204'
py36 run-test: commands[0] | python -c 'import sys; print(sys.version)'
3.6.9 (default, Jul 3 2019, 15:08:07)
[GCC 9.1.1 20190503 (Red Hat 9.1.1-1)]
Traceback (most recent call last):
File "runner.py", line 9, in <module>
assert 'py37' in cp.stdout
AssertionError
ERROR: InvocationError for command /home/churchyard/tmp/totox/.tox/py36/bin/python runner.py (exited with code 1)
==================================================== log end ====================================================
β FAIL py36 in 4.851 seconds
____________________________________________________ summary ____________________________________________________
ERROR: py36: parallel child exit code 1
ERROR: py37: parallel child exit code 1
ERROR: py38: parallel child exit code 1
|
AssertionError
|
def _summary(self):
is_parallel_child = PARALLEL_ENV_VAR_KEY_PRIVATE in os.environ
if not is_parallel_child:
reporter.separator("_", "summary", reporter.Verbosity.QUIET)
exit_code = 0
for venv in self.venv_dict.values():
report = reporter.good
status = getattr(venv, "status", "undefined")
if isinstance(status, tox.exception.InterpreterNotFound):
msg = " {}: {}".format(venv.envconfig.envname, str(status))
if self.config.option.skip_missing_interpreters == "true":
report = reporter.skip
else:
exit_code = 1
report = reporter.error
elif status == "platform mismatch":
msg = " {}: {} ({!r} does not match {!r})".format(
venv.envconfig.envname,
str(status),
sys.platform,
venv.envconfig.platform,
)
report = reporter.skip
elif status and status == "ignored failed command":
msg = " {}: {}".format(venv.envconfig.envname, str(status))
elif status and status != "skipped tests":
msg = " {}: {}".format(venv.envconfig.envname, str(status))
report = reporter.error
exit_code = 1
else:
if not status:
status = "commands succeeded"
msg = " {}: {}".format(venv.envconfig.envname, status)
if not is_parallel_child:
report(msg)
if not exit_code and not is_parallel_child:
reporter.good(" congratulations :)")
path = self.config.option.resultjson
if path:
if not is_parallel_child:
self._add_parallel_summaries()
path = py.path.local(path)
data = self.resultlog.dumps_json()
reporter.line("write json report at: {}".format(path))
path.write(data)
return exit_code
|
def _summary(self):
is_parallel_child = PARALLEL_ENV_VAR_KEY in os.environ
if not is_parallel_child:
reporter.separator("_", "summary", reporter.Verbosity.QUIET)
exit_code = 0
for venv in self.venv_dict.values():
report = reporter.good
status = getattr(venv, "status", "undefined")
if isinstance(status, tox.exception.InterpreterNotFound):
msg = " {}: {}".format(venv.envconfig.envname, str(status))
if self.config.option.skip_missing_interpreters == "true":
report = reporter.skip
else:
exit_code = 1
report = reporter.error
elif status == "platform mismatch":
msg = " {}: {} ({!r} does not match {!r})".format(
venv.envconfig.envname,
str(status),
sys.platform,
venv.envconfig.platform,
)
report = reporter.skip
elif status and status == "ignored failed command":
msg = " {}: {}".format(venv.envconfig.envname, str(status))
elif status and status != "skipped tests":
msg = " {}: {}".format(venv.envconfig.envname, str(status))
report = reporter.error
exit_code = 1
else:
if not status:
status = "commands succeeded"
msg = " {}: {}".format(venv.envconfig.envname, status)
if not is_parallel_child:
report(msg)
if not exit_code and not is_parallel_child:
reporter.good(" congratulations :)")
path = self.config.option.resultjson
if path:
if not is_parallel_child:
self._add_parallel_summaries()
path = py.path.local(path)
data = self.resultlog.dumps_json()
reporter.line("write json report at: {}".format(path))
path.write(data)
return exit_code
|
https://github.com/tox-dev/tox/issues/1444
|
$ tox -p all
β Έ [3] py36 | py37 | py38ERROR: invocation failed (exit code 1), logfile: /home/churchyard/tmp/totox/.tox/py37/log/py37-5.log
=================================================== log start ===================================================
py37 run-test-pre: PYTHONHASHSEED='1114882869'
py37 run-test: commands[0] | python runner.py
py37 run-test-pre: PYTHONHASHSEED='3136963143'
py37 run-test: commands[0] | python -c 'import sys; print(sys.version)'
3.7.5 (default, Oct 17 2019, 12:09:47)
[GCC 9.2.1 20190827 (Red Hat 9.2.1-1)]
Traceback (most recent call last):
File "runner.py", line 8, in <module>
assert 'py36' in cp.stdout
AssertionError
ERROR: InvocationError for command /home/churchyard/tmp/totox/.tox/py37/bin/python runner.py (exited with code 1)
==================================================== log end ====================================================
β FAIL py37 in 1.389 seconds
β ΄ [2] py36 | py38ERROR: invocation failed (exit code 1), logfile: /home/churchyard/tmp/totox/.tox/py38/log/py38-5.log
=================================================== log start ===================================================
py38 run-test-pre: PYTHONHASHSEED='3502501543'
py38 run-test: commands[0] | python runner.py
py38 run-test-pre: PYTHONHASHSEED='1953872060'
py38 run-test: commands[0] | python -c 'import sys; print(sys.version)'
3.8.0 (default, Oct 16 2019, 12:47:36)
[GCC 9.2.1 20190827 (Red Hat 9.2.1-1)]
Traceback (most recent call last):
File "runner.py", line 8, in <module>
assert 'py36' in cp.stdout
AssertionError
ERROR: InvocationError for command /home/churchyard/tmp/totox/.tox/py38/bin/python runner.py (exited with code 1)
==================================================== log end ====================================================
β FAIL py38 in 1.536 seconds
β [1] py36ERROR: invocation failed (exit code 1), logfile: /home/churchyard/tmp/totox/.tox/py36/log/py36-5.log
=================================================== log start ===================================================
py36 run-test-pre: PYTHONHASHSEED='664963699'
py36 run-test: commands[0] | python runner.py
py36 recreate: /home/churchyard/tmp/totox/inner/.tox/py36
py36 run-test-pre: PYTHONHASHSEED='4138548204'
py36 run-test: commands[0] | python -c 'import sys; print(sys.version)'
3.6.9 (default, Jul 3 2019, 15:08:07)
[GCC 9.1.1 20190503 (Red Hat 9.1.1-1)]
Traceback (most recent call last):
File "runner.py", line 9, in <module>
assert 'py37' in cp.stdout
AssertionError
ERROR: InvocationError for command /home/churchyard/tmp/totox/.tox/py36/bin/python runner.py (exited with code 1)
==================================================== log end ====================================================
β FAIL py36 in 4.851 seconds
____________________________________________________ summary ____________________________________________________
ERROR: py36: parallel child exit code 1
ERROR: py37: parallel child exit code 1
ERROR: py38: parallel child exit code 1
|
AssertionError
|
def run_parallel(config, venv_dict):
"""here we'll just start parallel sub-processes"""
live_out = config.option.parallel_live
disable_spinner = bool(os.environ.get("TOX_PARALLEL_NO_SPINNER") == "1")
args = [sys.executable, MAIN_FILE] + config.args
try:
position = args.index("--")
except ValueError:
position = len(args)
max_parallel = config.option.parallel
if max_parallel is None:
max_parallel = len(venv_dict)
semaphore = Semaphore(max_parallel)
finished = Event()
show_progress = (
not disable_spinner
and not live_out
and reporter.verbosity() > reporter.Verbosity.QUIET
)
with Spinner(enabled=show_progress) as spinner:
def run_in_thread(tox_env, os_env, processes):
output = None
env_name = tox_env.envconfig.envname
status = "skipped tests" if config.option.notest else None
try:
os_env[str(PARALLEL_ENV_VAR_KEY_PRIVATE)] = str(env_name)
os_env[str(PARALLEL_ENV_VAR_KEY_PUBLIC)] = str(env_name)
args_sub = list(args)
if hasattr(tox_env, "package"):
args_sub.insert(position, str(tox_env.package))
args_sub.insert(position, "--installpkg")
if tox_env.get_result_json_path():
result_json_index = args_sub.index("--result-json")
args_sub[result_json_index + 1] = "{}".format(
tox_env.get_result_json_path()
)
with tox_env.new_action("parallel {}".format(tox_env.name)) as action:
def collect_process(process):
processes[tox_env] = (action, process)
print_out = not live_out and tox_env.envconfig.parallel_show_output
output = action.popen(
args=args_sub,
env=os_env,
redirect=not live_out,
capture_err=print_out,
callback=collect_process,
returnout=print_out,
)
except InvocationError as err:
status = "parallel child exit code {}".format(err.exit_code)
finally:
semaphore.release()
finished.set()
tox_env.status = status
done.add(env_name)
outcome = spinner.succeed
if config.option.notest:
outcome = spinner.skip
elif status is not None:
outcome = spinner.fail
outcome(env_name)
if print_out and output is not None:
reporter.verbosity0(output)
threads = deque()
processes = {}
todo_keys = set(venv_dict.keys())
todo = OrderedDict(
(n, todo_keys & set(v.envconfig.depends)) for n, v in venv_dict.items()
)
done = set()
try:
while todo:
for name, depends in list(todo.items()):
if depends - done:
# skip if has unfinished dependencies
continue
del todo[name]
venv = venv_dict[name]
semaphore.acquire(blocking=True)
spinner.add(name)
thread = Thread(
target=run_in_thread, args=(venv, os.environ.copy(), processes)
)
thread.daemon = True
thread.start()
threads.append(thread)
if todo:
# wait until someone finishes and retry queuing jobs
finished.wait()
finished.clear()
while threads:
threads = [
thread
for thread in threads
if not thread.join(0.1) and thread.is_alive()
]
except KeyboardInterrupt:
reporter.verbosity0(
"[{}] KeyboardInterrupt parallel - stopping children".format(
os.getpid()
)
)
while True:
# do not allow to interrupt until children interrupt
try:
# putting it inside a thread so it's not interrupted
stopper = Thread(
target=_stop_child_processes, args=(processes, threads)
)
stopper.start()
stopper.join()
except KeyboardInterrupt:
continue
raise KeyboardInterrupt
|
def run_parallel(config, venv_dict):
"""here we'll just start parallel sub-processes"""
live_out = config.option.parallel_live
disable_spinner = bool(os.environ.get("TOX_PARALLEL_NO_SPINNER") == "1")
args = [sys.executable, MAIN_FILE] + config.args
try:
position = args.index("--")
except ValueError:
position = len(args)
max_parallel = config.option.parallel
if max_parallel is None:
max_parallel = len(venv_dict)
semaphore = Semaphore(max_parallel)
finished = Event()
show_progress = (
not disable_spinner
and not live_out
and reporter.verbosity() > reporter.Verbosity.QUIET
)
with Spinner(enabled=show_progress) as spinner:
def run_in_thread(tox_env, os_env, processes):
output = None
env_name = tox_env.envconfig.envname
status = "skipped tests" if config.option.notest else None
try:
os_env[str(PARALLEL_ENV_VAR_KEY)] = str(env_name)
args_sub = list(args)
if hasattr(tox_env, "package"):
args_sub.insert(position, str(tox_env.package))
args_sub.insert(position, "--installpkg")
if tox_env.get_result_json_path():
result_json_index = args_sub.index("--result-json")
args_sub[result_json_index + 1] = "{}".format(
tox_env.get_result_json_path()
)
with tox_env.new_action("parallel {}".format(tox_env.name)) as action:
def collect_process(process):
processes[tox_env] = (action, process)
print_out = not live_out and tox_env.envconfig.parallel_show_output
output = action.popen(
args=args_sub,
env=os_env,
redirect=not live_out,
capture_err=print_out,
callback=collect_process,
returnout=print_out,
)
except InvocationError as err:
status = "parallel child exit code {}".format(err.exit_code)
finally:
semaphore.release()
finished.set()
tox_env.status = status
done.add(env_name)
outcome = spinner.succeed
if config.option.notest:
outcome = spinner.skip
elif status is not None:
outcome = spinner.fail
outcome(env_name)
if print_out and output is not None:
reporter.verbosity0(output)
threads = deque()
processes = {}
todo_keys = set(venv_dict.keys())
todo = OrderedDict(
(n, todo_keys & set(v.envconfig.depends)) for n, v in venv_dict.items()
)
done = set()
try:
while todo:
for name, depends in list(todo.items()):
if depends - done:
# skip if has unfinished dependencies
continue
del todo[name]
venv = venv_dict[name]
semaphore.acquire(blocking=True)
spinner.add(name)
thread = Thread(
target=run_in_thread, args=(venv, os.environ.copy(), processes)
)
thread.daemon = True
thread.start()
threads.append(thread)
if todo:
# wait until someone finishes and retry queuing jobs
finished.wait()
finished.clear()
while threads:
threads = [
thread
for thread in threads
if not thread.join(0.1) and thread.is_alive()
]
except KeyboardInterrupt:
reporter.verbosity0(
"[{}] KeyboardInterrupt parallel - stopping children".format(
os.getpid()
)
)
while True:
# do not allow to interrupt until children interrupt
try:
# putting it inside a thread so it's not interrupted
stopper = Thread(
target=_stop_child_processes, args=(processes, threads)
)
stopper.start()
stopper.join()
except KeyboardInterrupt:
continue
raise KeyboardInterrupt
|
https://github.com/tox-dev/tox/issues/1444
|
$ tox -p all
β Έ [3] py36 | py37 | py38ERROR: invocation failed (exit code 1), logfile: /home/churchyard/tmp/totox/.tox/py37/log/py37-5.log
=================================================== log start ===================================================
py37 run-test-pre: PYTHONHASHSEED='1114882869'
py37 run-test: commands[0] | python runner.py
py37 run-test-pre: PYTHONHASHSEED='3136963143'
py37 run-test: commands[0] | python -c 'import sys; print(sys.version)'
3.7.5 (default, Oct 17 2019, 12:09:47)
[GCC 9.2.1 20190827 (Red Hat 9.2.1-1)]
Traceback (most recent call last):
File "runner.py", line 8, in <module>
assert 'py36' in cp.stdout
AssertionError
ERROR: InvocationError for command /home/churchyard/tmp/totox/.tox/py37/bin/python runner.py (exited with code 1)
==================================================== log end ====================================================
β FAIL py37 in 1.389 seconds
β ΄ [2] py36 | py38ERROR: invocation failed (exit code 1), logfile: /home/churchyard/tmp/totox/.tox/py38/log/py38-5.log
=================================================== log start ===================================================
py38 run-test-pre: PYTHONHASHSEED='3502501543'
py38 run-test: commands[0] | python runner.py
py38 run-test-pre: PYTHONHASHSEED='1953872060'
py38 run-test: commands[0] | python -c 'import sys; print(sys.version)'
3.8.0 (default, Oct 16 2019, 12:47:36)
[GCC 9.2.1 20190827 (Red Hat 9.2.1-1)]
Traceback (most recent call last):
File "runner.py", line 8, in <module>
assert 'py36' in cp.stdout
AssertionError
ERROR: InvocationError for command /home/churchyard/tmp/totox/.tox/py38/bin/python runner.py (exited with code 1)
==================================================== log end ====================================================
β FAIL py38 in 1.536 seconds
β [1] py36ERROR: invocation failed (exit code 1), logfile: /home/churchyard/tmp/totox/.tox/py36/log/py36-5.log
=================================================== log start ===================================================
py36 run-test-pre: PYTHONHASHSEED='664963699'
py36 run-test: commands[0] | python runner.py
py36 recreate: /home/churchyard/tmp/totox/inner/.tox/py36
py36 run-test-pre: PYTHONHASHSEED='4138548204'
py36 run-test: commands[0] | python -c 'import sys; print(sys.version)'
3.6.9 (default, Jul 3 2019, 15:08:07)
[GCC 9.1.1 20190503 (Red Hat 9.1.1-1)]
Traceback (most recent call last):
File "runner.py", line 9, in <module>
assert 'py37' in cp.stdout
AssertionError
ERROR: InvocationError for command /home/churchyard/tmp/totox/.tox/py36/bin/python runner.py (exited with code 1)
==================================================== log end ====================================================
β FAIL py36 in 4.851 seconds
____________________________________________________ summary ____________________________________________________
ERROR: py36: parallel child exit code 1
ERROR: py37: parallel child exit code 1
ERROR: py38: parallel child exit code 1
|
AssertionError
|
def run_in_thread(tox_env, os_env, processes):
output = None
env_name = tox_env.envconfig.envname
status = "skipped tests" if config.option.notest else None
try:
os_env[str(PARALLEL_ENV_VAR_KEY_PRIVATE)] = str(env_name)
os_env[str(PARALLEL_ENV_VAR_KEY_PUBLIC)] = str(env_name)
args_sub = list(args)
if hasattr(tox_env, "package"):
args_sub.insert(position, str(tox_env.package))
args_sub.insert(position, "--installpkg")
if tox_env.get_result_json_path():
result_json_index = args_sub.index("--result-json")
args_sub[result_json_index + 1] = "{}".format(
tox_env.get_result_json_path()
)
with tox_env.new_action("parallel {}".format(tox_env.name)) as action:
def collect_process(process):
processes[tox_env] = (action, process)
print_out = not live_out and tox_env.envconfig.parallel_show_output
output = action.popen(
args=args_sub,
env=os_env,
redirect=not live_out,
capture_err=print_out,
callback=collect_process,
returnout=print_out,
)
except InvocationError as err:
status = "parallel child exit code {}".format(err.exit_code)
finally:
semaphore.release()
finished.set()
tox_env.status = status
done.add(env_name)
outcome = spinner.succeed
if config.option.notest:
outcome = spinner.skip
elif status is not None:
outcome = spinner.fail
outcome(env_name)
if print_out and output is not None:
reporter.verbosity0(output)
|
def run_in_thread(tox_env, os_env, processes):
output = None
env_name = tox_env.envconfig.envname
status = "skipped tests" if config.option.notest else None
try:
os_env[str(PARALLEL_ENV_VAR_KEY)] = str(env_name)
args_sub = list(args)
if hasattr(tox_env, "package"):
args_sub.insert(position, str(tox_env.package))
args_sub.insert(position, "--installpkg")
if tox_env.get_result_json_path():
result_json_index = args_sub.index("--result-json")
args_sub[result_json_index + 1] = "{}".format(
tox_env.get_result_json_path()
)
with tox_env.new_action("parallel {}".format(tox_env.name)) as action:
def collect_process(process):
processes[tox_env] = (action, process)
print_out = not live_out and tox_env.envconfig.parallel_show_output
output = action.popen(
args=args_sub,
env=os_env,
redirect=not live_out,
capture_err=print_out,
callback=collect_process,
returnout=print_out,
)
except InvocationError as err:
status = "parallel child exit code {}".format(err.exit_code)
finally:
semaphore.release()
finished.set()
tox_env.status = status
done.add(env_name)
outcome = spinner.succeed
if config.option.notest:
outcome = spinner.skip
elif status is not None:
outcome = spinner.fail
outcome(env_name)
if print_out and output is not None:
reporter.verbosity0(output)
|
https://github.com/tox-dev/tox/issues/1444
|
$ tox -p all
β Έ [3] py36 | py37 | py38ERROR: invocation failed (exit code 1), logfile: /home/churchyard/tmp/totox/.tox/py37/log/py37-5.log
=================================================== log start ===================================================
py37 run-test-pre: PYTHONHASHSEED='1114882869'
py37 run-test: commands[0] | python runner.py
py37 run-test-pre: PYTHONHASHSEED='3136963143'
py37 run-test: commands[0] | python -c 'import sys; print(sys.version)'
3.7.5 (default, Oct 17 2019, 12:09:47)
[GCC 9.2.1 20190827 (Red Hat 9.2.1-1)]
Traceback (most recent call last):
File "runner.py", line 8, in <module>
assert 'py36' in cp.stdout
AssertionError
ERROR: InvocationError for command /home/churchyard/tmp/totox/.tox/py37/bin/python runner.py (exited with code 1)
==================================================== log end ====================================================
β FAIL py37 in 1.389 seconds
β ΄ [2] py36 | py38ERROR: invocation failed (exit code 1), logfile: /home/churchyard/tmp/totox/.tox/py38/log/py38-5.log
=================================================== log start ===================================================
py38 run-test-pre: PYTHONHASHSEED='3502501543'
py38 run-test: commands[0] | python runner.py
py38 run-test-pre: PYTHONHASHSEED='1953872060'
py38 run-test: commands[0] | python -c 'import sys; print(sys.version)'
3.8.0 (default, Oct 16 2019, 12:47:36)
[GCC 9.2.1 20190827 (Red Hat 9.2.1-1)]
Traceback (most recent call last):
File "runner.py", line 8, in <module>
assert 'py36' in cp.stdout
AssertionError
ERROR: InvocationError for command /home/churchyard/tmp/totox/.tox/py38/bin/python runner.py (exited with code 1)
==================================================== log end ====================================================
β FAIL py38 in 1.536 seconds
β [1] py36ERROR: invocation failed (exit code 1), logfile: /home/churchyard/tmp/totox/.tox/py36/log/py36-5.log
=================================================== log start ===================================================
py36 run-test-pre: PYTHONHASHSEED='664963699'
py36 run-test: commands[0] | python runner.py
py36 recreate: /home/churchyard/tmp/totox/inner/.tox/py36
py36 run-test-pre: PYTHONHASHSEED='4138548204'
py36 run-test: commands[0] | python -c 'import sys; print(sys.version)'
3.6.9 (default, Jul 3 2019, 15:08:07)
[GCC 9.1.1 20190503 (Red Hat 9.1.1-1)]
Traceback (most recent call last):
File "runner.py", line 9, in <module>
assert 'py37' in cp.stdout
AssertionError
ERROR: InvocationError for command /home/churchyard/tmp/totox/.tox/py36/bin/python runner.py (exited with code 1)
==================================================== log end ====================================================
β FAIL py36 in 4.851 seconds
____________________________________________________ summary ____________________________________________________
ERROR: py36: parallel child exit code 1
ERROR: py37: parallel child exit code 1
ERROR: py38: parallel child exit code 1
|
AssertionError
|
def cleanup_for_venv(venv):
within_parallel = PARALLEL_ENV_VAR_KEY_PRIVATE in os.environ
# if the directory exists and it doesn't look like a virtualenv, produce
# an error
if venv.path.exists():
dir_items = set(os.listdir(str(venv.path))) - {".lock", "log"}
dir_items = {
p for p in dir_items if not p.startswith(".tox-") or p == ".tox-config1"
}
else:
dir_items = set()
if not (
# doesn't exist => OK
not venv.path.exists()
# does exist, but it's empty => OK
or not dir_items
# tox has marked this as an environment it has created in the past
or ".tox-config1" in dir_items
# it exists and we're on windows with Lib and Scripts => OK
or (INFO.IS_WIN and dir_items > {"Scripts", "Lib"})
# non-windows, with lib and bin => OK
or dir_items > {"bin", "lib"}
# pypy has a different lib folder => OK
or dir_items > {"bin", "lib_pypy"}
):
venv.status = "error"
reporter.error(
"cowardly refusing to delete `envdir` (it does not look like a virtualenv): "
"{}".format(venv.path)
)
raise SystemExit(2)
if within_parallel:
if venv.path.exists():
# do not delete the log folder as that's used by parent
for content in venv.path.listdir():
if not content.basename == "log":
content.remove(rec=1, ignore_errors=True)
else:
ensure_empty_dir(venv.path)
|
def cleanup_for_venv(venv):
within_parallel = PARALLEL_ENV_VAR_KEY in os.environ
# if the directory exists and it doesn't look like a virtualenv, produce
# an error
if venv.path.exists():
dir_items = set(os.listdir(str(venv.path))) - {".lock", "log"}
dir_items = {
p for p in dir_items if not p.startswith(".tox-") or p == ".tox-config1"
}
else:
dir_items = set()
if not (
# doesn't exist => OK
not venv.path.exists()
# does exist, but it's empty => OK
or not dir_items
# tox has marked this as an environment it has created in the past
or ".tox-config1" in dir_items
# it exists and we're on windows with Lib and Scripts => OK
or (INFO.IS_WIN and dir_items > {"Scripts", "Lib"})
# non-windows, with lib and bin => OK
or dir_items > {"bin", "lib"}
# pypy has a different lib folder => OK
or dir_items > {"bin", "lib_pypy"}
):
venv.status = "error"
reporter.error(
"cowardly refusing to delete `envdir` (it does not look like a virtualenv): "
"{}".format(venv.path)
)
raise SystemExit(2)
if within_parallel:
if venv.path.exists():
# do not delete the log folder as that's used by parent
for content in venv.path.listdir():
if not content.basename == "log":
content.remove(rec=1, ignore_errors=True)
else:
ensure_empty_dir(venv.path)
|
https://github.com/tox-dev/tox/issues/1444
|
$ tox -p all
β Έ [3] py36 | py37 | py38ERROR: invocation failed (exit code 1), logfile: /home/churchyard/tmp/totox/.tox/py37/log/py37-5.log
=================================================== log start ===================================================
py37 run-test-pre: PYTHONHASHSEED='1114882869'
py37 run-test: commands[0] | python runner.py
py37 run-test-pre: PYTHONHASHSEED='3136963143'
py37 run-test: commands[0] | python -c 'import sys; print(sys.version)'
3.7.5 (default, Oct 17 2019, 12:09:47)
[GCC 9.2.1 20190827 (Red Hat 9.2.1-1)]
Traceback (most recent call last):
File "runner.py", line 8, in <module>
assert 'py36' in cp.stdout
AssertionError
ERROR: InvocationError for command /home/churchyard/tmp/totox/.tox/py37/bin/python runner.py (exited with code 1)
==================================================== log end ====================================================
β FAIL py37 in 1.389 seconds
β ΄ [2] py36 | py38ERROR: invocation failed (exit code 1), logfile: /home/churchyard/tmp/totox/.tox/py38/log/py38-5.log
=================================================== log start ===================================================
py38 run-test-pre: PYTHONHASHSEED='3502501543'
py38 run-test: commands[0] | python runner.py
py38 run-test-pre: PYTHONHASHSEED='1953872060'
py38 run-test: commands[0] | python -c 'import sys; print(sys.version)'
3.8.0 (default, Oct 16 2019, 12:47:36)
[GCC 9.2.1 20190827 (Red Hat 9.2.1-1)]
Traceback (most recent call last):
File "runner.py", line 8, in <module>
assert 'py36' in cp.stdout
AssertionError
ERROR: InvocationError for command /home/churchyard/tmp/totox/.tox/py38/bin/python runner.py (exited with code 1)
==================================================== log end ====================================================
β FAIL py38 in 1.536 seconds
β [1] py36ERROR: invocation failed (exit code 1), logfile: /home/churchyard/tmp/totox/.tox/py36/log/py36-5.log
=================================================== log start ===================================================
py36 run-test-pre: PYTHONHASHSEED='664963699'
py36 run-test: commands[0] | python runner.py
py36 recreate: /home/churchyard/tmp/totox/inner/.tox/py36
py36 run-test-pre: PYTHONHASHSEED='4138548204'
py36 run-test: commands[0] | python -c 'import sys; print(sys.version)'
3.6.9 (default, Jul 3 2019, 15:08:07)
[GCC 9.1.1 20190503 (Red Hat 9.1.1-1)]
Traceback (most recent call last):
File "runner.py", line 9, in <module>
assert 'py37' in cp.stdout
AssertionError
ERROR: InvocationError for command /home/churchyard/tmp/totox/.tox/py36/bin/python runner.py (exited with code 1)
==================================================== log end ====================================================
β FAIL py36 in 4.851 seconds
____________________________________________________ summary ____________________________________________________
ERROR: py36: parallel child exit code 1
ERROR: py37: parallel child exit code 1
ERROR: py38: parallel child exit code 1
|
AssertionError
|
def process_set(hive, hive_name, key, flags, default_arch):
try:
with winreg.OpenKeyEx(hive, key, 0, winreg.KEY_READ | flags) as root_key:
for company in enum_keys(root_key):
if company == "PyLauncher": # reserved
continue
for spec in process_company(hive_name, company, root_key, default_arch):
yield spec
except OSError:
pass
|
def process_set(hive, hive_name, key, flags, default_arch):
try:
with winreg.OpenKeyEx(hive, key, access=winreg.KEY_READ | flags) as root_key:
for company in enum_keys(root_key):
if company == "PyLauncher": # reserved
continue
for spec in process_company(hive_name, company, root_key, default_arch):
yield spec
except OSError:
pass
|
https://github.com/tox-dev/tox/issues/1315
|
$ tox -e py37
GLOB sdist-make: C:\Users\Anthony\AppData\Local\Temp\x\tox\aspy.yaml\setup.py
py37 create: C:\Users\Anthony\AppData\Local\Temp\x\tox\aspy.yaml\.tox\py37
___________________________________ summary ___________________________________
py37: commands succeeded
congratulations :)
Traceback (most recent call last):
File "C:\Users\Anthony\AppData\Local\Temp\x\tox\aspy.yaml\venv\Scripts\tox-script.py", line 11, in <module>
load_entry_point('tox', 'console_scripts', 'tox')()
File "c:\users\anthony\appdata\local\temp\x\tox\src\tox\session\__init__.py",line 44, in cmdline
main(args)
File "c:\users\anthony\appdata\local\temp\x\tox\src\tox\session\__init__.py",line 68, in main
exit_code = session.runcommand()
File "c:\users\anthony\appdata\local\temp\x\tox\src\tox\session\__init__.py",line 192, in runcommand
return self.subcommand_test()
File "c:\users\anthony\appdata\local\temp\x\tox\src\tox\session\__init__.py",line 220, in subcommand_test
run_sequential(self.config, self.venv_dict)
File "c:\users\anthony\appdata\local\temp\x\tox\src\tox\session\commands\run\sequential.py", line 9, in run_sequential
if venv.setupenv():
File "c:\users\anthony\appdata\local\temp\x\tox\src\tox\venv.py", line 595, in setupenv
status = self.update(action=action)
File "c:\users\anthony\appdata\local\temp\x\tox\src\tox\venv.py", line 253, in update
self.hook.tox_testenv_create(action=action, venv=self)
File "c:\users\anthony\appdata\local\temp\x\tox\aspy.yaml\venv\lib\site-packages\pluggy\hooks.py", line 289, in __call__
return self._hookexec(self, self.get_hookimpls(), kwargs)
File "c:\users\anthony\appdata\local\temp\x\tox\aspy.yaml\venv\lib\site-packages\pluggy\manager.py", line 68, in _hookexec
return self._inner_hookexec(hook, methods, kwargs)
File "c:\users\anthony\appdata\local\temp\x\tox\aspy.yaml\venv\lib\site-packages\pluggy\manager.py", line 62, in <lambda>
firstresult=hook.spec.opts.get("firstresult") if hook.spec else False,
File "c:\users\anthony\appdata\local\temp\x\tox\aspy.yaml\venv\lib\site-packages\pluggy\callers.py", line 208, in _multicall
return outcome.get_result()
File "c:\users\anthony\appdata\local\temp\x\tox\aspy.yaml\venv\lib\site-packages\pluggy\callers.py", line 81, in get_result
_reraise(*ex) # noqa
File "c:\users\anthony\appdata\local\temp\x\tox\aspy.yaml\venv\lib\site-packages\pluggy\callers.py", line 187, in _multicall
res = hook_impl.function(*args)
File "c:\users\anthony\appdata\local\temp\x\tox\src\tox\venv.py", line 665, in tox_testenv_create
config_interpreter = venv.getsupportedinterpreter()
File "c:\users\anthony\appdata\local\temp\x\tox\src\tox\venv.py", line 294, in getsupportedinterpreter
return self.envconfig.getsupportedinterpreter()
File "c:\users\anthony\appdata\local\temp\x\tox\src\tox\config\__init__.py", line 953, in getsupportedinterpreter
info = self.config.interpreters.get_info(envconfig=self)
File "c:\users\anthony\appdata\local\temp\x\tox\src\tox\interpreters\__init__.py", line 32, in get_info
executable = self.get_executable(envconfig)
File "c:\users\anthony\appdata\local\temp\x\tox\src\tox\interpreters\__init__.py", line 26, in get_executable
exe = self.hook.tox_get_python_executable(envconfig=envconfig)
File "c:\users\anthony\appdata\local\temp\x\tox\aspy.yaml\venv\lib\site-packages\pluggy\hooks.py", line 289, in __call__
return self._hookexec(self, self.get_hookimpls(), kwargs)
File "c:\users\anthony\appdata\local\temp\x\tox\aspy.yaml\venv\lib\site-packages\pluggy\manager.py", line 68, in _hookexec
return self._inner_hookexec(hook, methods, kwargs)
File "c:\users\anthony\appdata\local\temp\x\tox\aspy.yaml\venv\lib\site-packages\pluggy\manager.py", line 62, in <lambda>
firstresult=hook.spec.opts.get("firstresult") if hook.spec else False,
File "c:\users\anthony\appdata\local\temp\x\tox\aspy.yaml\venv\lib\site-packages\pluggy\callers.py", line 208, in _multicall
return outcome.get_result()
File "c:\users\anthony\appdata\local\temp\x\tox\aspy.yaml\venv\lib\site-packages\pluggy\callers.py", line 81, in get_result
_reraise(*ex) # noqa
File "c:\users\anthony\appdata\local\temp\x\tox\aspy.yaml\venv\lib\site-packages\pluggy\callers.py", line 187, in _multicall
res = hook_impl.function(*args)
File "c:\users\anthony\appdata\local\temp\x\tox\src\tox\interpreters\windows\__init__.py", line 21, in tox_get_python_executable
py_exe = locate_via_pep514(spec)
File "c:\users\anthony\appdata\local\temp\x\tox\src\tox\interpreters\windows\__init__.py", line 45, in locate_via_pep514
from . import pep514
File "c:\users\anthony\appdata\local\temp\x\tox\src\tox\interpreters\windows\pep514.py", line 8, in <module>
import winreg
ImportError: No module named winreg
|
ImportError
|
def run_and_get_interpreter_info(name, executable):
assert executable
try:
result = exec_on_interpreter(str(executable), VERSION_QUERY_SCRIPT)
result["version_info"] = tuple(
result["version_info"]
) # fix json dump transformation
del result["name"]
del result["version"]
result["executable"] = str(executable)
except ExecFailed as e:
return NoInterpreterInfo(name, executable=e.executable, out=e.out, err=e.err)
else:
return InterpreterInfo(name, **result)
|
def run_and_get_interpreter_info(name, executable):
assert executable
try:
result = exec_on_interpreter(str(executable), VERSION_QUERY_SCRIPT)
result["version_info"] = tuple(
result["version_info"]
) # fix json dump transformation
del result["name"]
del result["version"]
except ExecFailed as e:
return NoInterpreterInfo(name, executable=e.executable, out=e.out, err=e.err)
else:
return InterpreterInfo(name, **result)
|
https://github.com/tox-dev/tox/issues/1300
|
using tox.ini: /home/asw/dev/amazepackage/tox.ini (pid 42122)
removing /home/asw/dev/amazepackage/.tox/log
using tox-3.8.0 from /usr/lib/python2.7/site-packages/tox/__init__.pyc (pid 42122)
skipping sdist step
secretpy27 start: getenv /home/asw/dev/amazepackage/.tox/secretpy27
secretpy27 cannot reuse: -r flag
secretpy27 create: /home/asw/dev/amazepackage/.tox/secretpy27
setting PATH=/home/asw/dev/amazepackage/.tox/secretpy27/bin:/usr/bin
[42255] /home/asw/dev/amazepackage/.tox$ /usr/bin/python -m virtualenv --always-copy --python /secret_environment/bin/python2.7 secretpy27
Running virtualenv with interpreter /secret_environment/bin/python2.7
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/virtualenv.py", line 32, in <module>
import subprocess
File "/secret_environment/lib/python2.7/subprocess.py", line 427, in <module>
import select
ImportError: /secret_environment/lib/python2.7/lib-dynload/select.so: undefined symbol: _PyInt_AsInt
ERROR: invocation failed (exit code 1)
ERROR: InvocationError for command /usr/bin/python -m virtualenv --always-copy --python /secret_environment/bin/python2.7 secretpy27 (exited with code 1)
secretpy27 finish: getenv /home/asw/dev/amazepackage/.tox/secretpy27 after 0.84 seconds
___________________________________________________________________________________________ summary ___________________________________________________________________________________________ERROR: secretpy27: InvocationError for command /usr/bin/python -m virtualenv --always-copy --python /secret_environment/bin/python2.7 secretpy27 (exited with code 1)
|
ImportError
|
def set_python_info(self, python_executable):
cmd = [str(python_executable), VERSION_QUERY_SCRIPT]
result = subprocess.check_output(cmd, universal_newlines=True)
answer = json.loads(result)
answer["executable"] = python_executable
self.dict["python"] = answer
|
def set_python_info(self, python_executable):
cmd = [str(python_executable), VERSION_QUERY_SCRIPT]
result = subprocess.check_output(cmd, universal_newlines=True)
answer = json.loads(result)
self.dict["python"] = answer
|
https://github.com/tox-dev/tox/issues/1300
|
using tox.ini: /home/asw/dev/amazepackage/tox.ini (pid 42122)
removing /home/asw/dev/amazepackage/.tox/log
using tox-3.8.0 from /usr/lib/python2.7/site-packages/tox/__init__.pyc (pid 42122)
skipping sdist step
secretpy27 start: getenv /home/asw/dev/amazepackage/.tox/secretpy27
secretpy27 cannot reuse: -r flag
secretpy27 create: /home/asw/dev/amazepackage/.tox/secretpy27
setting PATH=/home/asw/dev/amazepackage/.tox/secretpy27/bin:/usr/bin
[42255] /home/asw/dev/amazepackage/.tox$ /usr/bin/python -m virtualenv --always-copy --python /secret_environment/bin/python2.7 secretpy27
Running virtualenv with interpreter /secret_environment/bin/python2.7
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/virtualenv.py", line 32, in <module>
import subprocess
File "/secret_environment/lib/python2.7/subprocess.py", line 427, in <module>
import select
ImportError: /secret_environment/lib/python2.7/lib-dynload/select.so: undefined symbol: _PyInt_AsInt
ERROR: invocation failed (exit code 1)
ERROR: InvocationError for command /usr/bin/python -m virtualenv --always-copy --python /secret_environment/bin/python2.7 secretpy27 (exited with code 1)
secretpy27 finish: getenv /home/asw/dev/amazepackage/.tox/secretpy27 after 0.84 seconds
___________________________________________________________________________________________ summary ___________________________________________________________________________________________ERROR: secretpy27: InvocationError for command /usr/bin/python -m virtualenv --always-copy --python /secret_environment/bin/python2.7 secretpy27 (exited with code 1)
|
ImportError
|
def parse_build_isolation(self, config, reader):
config.isolated_build = reader.getbool("isolated_build", False)
config.isolated_build_env = reader.getstring("isolated_build_env", ".package")
if config.isolated_build is True:
name = config.isolated_build_env
section_name = "testenv:{}".format(name)
if section_name not in self._cfg.sections:
self._cfg.sections[section_name] = {}
self._cfg.sections[section_name]["deps"] = ""
self._cfg.sections[section_name]["sitepackages"] = "False"
self._cfg.sections[section_name]["description"] = (
"isolated packaging environment"
)
config.envconfigs[name] = self.make_envconfig(
name, "{}{}".format(testenvprefix, name), reader._subs, config
)
|
def parse_build_isolation(self, config, reader):
config.isolated_build = reader.getbool("isolated_build", False)
config.isolated_build_env = reader.getstring("isolated_build_env", ".package")
if config.isolated_build is True:
name = config.isolated_build_env
section_name = "testenv:{}".format(name)
if section_name not in self._cfg.sections:
self._cfg.sections[section_name] = {}
self._cfg.sections[section_name]["description"] = (
"isolated packaging environment"
)
config.envconfigs[name] = self.make_envconfig(
name, "{}{}".format(testenvprefix, name), reader._subs, config
)
|
https://github.com/tox-dev/tox/issues/1239
|
$ tox -e metadata-validation --notest -vv
using tox.ini: ~/src/github/ansible/molecule/tox.ini (pid 8030)
removing ~/src/github/ansible/molecule/.tox/log
using tox-3.8.4 from ~/.pyenv/versions/3.7.1/lib/python3.7/site-packages/tox/__init__.py (pid 8030)
.package start: getenv ~/src/github/ansible/molecule/.tox/.package
.package cannot reuse: no previous config ~/src/github/ansible/molecule/.tox/.package/.tox-config1
.package create: ~/src/github/ansible/molecule/.tox/.package
removing ~/src/github/ansible/molecule/.tox/.package
setting PATH=~/src/github/ansible/molecule/.tox/.package/bin:~/.pyenv/versions/3.7.1/bin:~/.pyenv/libexec:~/.pyenv/plugins/python-build/bin:~/.pyenv/plugins/pyenv-virtualenv/bin:~/.pyenv/plugins/pyenv-update/bin:~/.pyenv/plugins/pyenv-installer/bin:~/.pyenv/plugins/pyenv-doctor/bin:~/.nvm/versions/node/v9.8.0/bin:~/.pyenv/shims:/usr/lib/llvm/7/bin:/usr/lib/llvm/6/bin:/usr/lib/llvm/5/bin:/usr/local/bin:/usr/bin:/bin:/opt/bin:~/.pyenv/bin
[8077] ~/src/github/ansible/molecule/.tox$ ~/.pyenv/versions/3.7.1/bin/python3.7 -m virtualenv --system-site-packages --python ~/.pyenv/versions/3.7.1/bin/python3.7 .package
Already using interpreter ~/.pyenv/versions/3.7.1/bin/python3.7
Using base prefix '~/.pyenv/versions/3.7.1'
~/.pyenv/versions/3.7.1/lib/python3.7/site-packages/virtualenv.py:1041: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
import imp
New python executable in ~/src/github/ansible/molecule/.tox/.package/bin/python3.7
Also creating executable in ~/src/github/ansible/molecule/.tox/.package/bin/python
Installing setuptools, pip, wheel...done.
.package installdeps: setuptools >= 40.8.0, setuptools_scm >= 1.15.0, setuptools_scm_git_archive >= 1.0, wheel, -rlint-requirements.txt, -rtest-requirements.txt
setting PATH=~/src/github/ansible/molecule/.tox/.package/bin:~/.pyenv/versions/3.7.1/bin:~/.pyenv/libexec:~/.pyenv/plugins/python-build/bin:~/.pyenv/plugins/pyenv-virtualenv/bin:~/.pyenv/plugins/pyenv-update/bin:~/.pyenv/plugins/pyenv-installer/bin:~/.pyenv/plugins/pyenv-doctor/bin:~/.nvm/versions/node/v9.8.0/bin:~/.pyenv/shims:/usr/lib/llvm/7/bin:/usr/lib/llvm/6/bin:/usr/lib/llvm/5/bin:/usr/local/bin:/usr/bin:/bin:/opt/bin:~/.pyenv/bin
[8144] ~/src/github/ansible/molecule$ ~/src/github/ansible/molecule/.tox/.package/bin/python -m pip install 'setuptools >= 40.8.0' 'setuptools_scm >= 1.15.0' 'setuptools_scm_git_archive >= 1.0' wheel -rlint-requirements.txt -rtest-requirements.txt
Double requirement given: wheel==0.30.0 (from -r test-requirements.txt (line 12)) (already in wheel, name='wheel')
ERROR: invocation failed (exit code 1)
ERROR: could not install deps [setuptools >= 40.8.0, setuptools_scm >= 1.15.0, setuptools_scm_git_archive >= 1.0, wheel, -rlint-requirements.txt, -rtest-requirements.txt]; v = InvocationError("~/src/github/ansible/molecule/.tox/.package/bin/python -m pip install 'setuptools >= 40.8.0' 'setuptools_scm >= 1.15.0' 'setuptools_scm_git_archive >= 1.0' wheel -rlint-requirements.txt -rtest-requirements.txt", 1)
.package finish: getenv ~/src/github/ansible/molecule/.tox/.package after 3.18 seconds
.package start: get-build-requires ~/src/github/ansible/molecule/.tox/.package
setting PATH=~/src/github/ansible/molecule/.tox/.package/bin:~/.pyenv/versions/3.7.1/bin:~/.pyenv/libexec:~/.pyenv/plugins/python-build/bin:~/.pyenv/plugins/pyenv-virtualenv/bin:~/.pyenv/plugins/pyenv-update/bin:~/.pyenv/plugins/pyenv-installer/bin:~/.pyenv/plugins/pyenv-doctor/bin:~/.nvm/versions/node/v9.8.0/bin:~/.pyenv/shims:/usr/lib/llvm/7/bin:/usr/lib/llvm/6/bin:/usr/lib/llvm/5/bin:/usr/local/bin:/usr/bin:/bin:/opt/bin:~/.pyenv/bin
[8151] ~/src/github/ansible/molecule$ ~/src/github/ansible/molecule/.tox/.package/bin/python ~/.pyenv/versions/3.7.1/lib/python3.7/site-packages/tox/helper/build_requires.py setuptools.build_meta '' >.tox/.package/log/.package-0.log
.package finish: get-build-requires ~/src/github/ansible/molecule/.tox/.package after 0.30 seconds
Traceback (most recent call last):
File "~/.pyenv/versions/3.7.1/lib/python3.7/site-packages/pkg_resources/_vendor/packaging/requirements.py", line 90, in __init__
req = REQUIREMENT.parseString(requirement_string)
File "~/.pyenv/versions/3.7.1/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 1654, in parseString
raise exc
File "~/.pyenv/versions/3.7.1/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 1644, in parseString
loc, tokens = self._parse( instring, 0 )
File "~/.pyenv/versions/3.7.1/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 1402, in _parseNoCache
loc,tokens = self.parseImpl( instring, preloc, doActions )
File "~/.pyenv/versions/3.7.1/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 3417, in parseImpl
loc, exprtokens = e._parse( instring, loc, doActions )
File "~/.pyenv/versions/3.7.1/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 1402, in _parseNoCache
loc,tokens = self.parseImpl( instring, preloc, doActions )
File "~/.pyenv/versions/3.7.1/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 3739, in parseImpl
return self.expr._parse( instring, loc, doActions, callPreParse=False )
File "~/.pyenv/versions/3.7.1/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 1402, in _parseNoCache
loc,tokens = self.parseImpl( instring, preloc, doActions )
File "~/.pyenv/versions/3.7.1/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 3400, in parseImpl
loc, resultlist = self.exprs[0]._parse( instring, loc, doActions, callPreParse=False )
File "~/.pyenv/versions/3.7.1/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 1406, in _parseNoCache
loc,tokens = self.parseImpl( instring, preloc, doActions )
File "~/.pyenv/versions/3.7.1/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 2711, in parseImpl
raise ParseException(instring, loc, self.errmsg, self)
pkg_resources._vendor.pyparsing.ParseException: Expected W:(abcd...) (at char 0), (line:1, col:1)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "~/.pyenv/versions/3.7.1/lib/python3.7/site-packages/pkg_resources/__init__.py", line 3042, in __init__
super(Requirement, self).__init__(requirement_string)
File "~/.pyenv/versions/3.7.1/lib/python3.7/site-packages/pkg_resources/_vendor/packaging/requirements.py", line 94, in __init__
requirement_string[e.loc:e.loc + 8]))
pkg_resources.extern.packaging.requirements.InvalidRequirement: Invalid requirement, parse error at "'-rlint-r'"
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "~/.pyenv/versions/3.7.1/bin/tox", line 10, in <module>
sys.exit(cmdline())
File "~/.pyenv/versions/3.7.1/lib/python3.7/site-packages/tox/session/__init__.py", line 43, in cmdline
main(args)
File "~/.pyenv/versions/3.7.1/lib/python3.7/site-packages/tox/session/__init__.py", line 68, in main
exit_code = session.runcommand()
File "~/.pyenv/versions/3.7.1/lib/python3.7/site-packages/tox/session/__init__.py", line 192, in runcommand
return self.subcommand_test()
File "~/.pyenv/versions/3.7.1/lib/python3.7/site-packages/tox/session/__init__.py", line 208, in subcommand_test
venv.package = self.hook.tox_package(session=self, venv=venv)
File "~/.pyenv/versions/3.7.1/lib/python3.7/site-packages/pluggy/__init__.py", line 617, in __call__
return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
File "~/.pyenv/versions/3.7.1/lib/python3.7/site-packages/pluggy/__init__.py", line 222, in _hookexec
return self._inner_hookexec(hook, methods, kwargs)
File "~/.pyenv/versions/3.7.1/lib/python3.7/site-packages/pluggy/__init__.py", line 216, in <lambda>
firstresult=hook.spec_opts.get('firstresult'),
File "~/.pyenv/versions/3.7.1/lib/python3.7/site-packages/pluggy/callers.py", line 201, in _multicall
return outcome.get_result()
File "~/.pyenv/versions/3.7.1/lib/python3.7/site-packages/pluggy/callers.py", line 76, in get_result
raise ex[1].with_traceback(ex[2])
File "~/.pyenv/versions/3.7.1/lib/python3.7/site-packages/pluggy/callers.py", line 180, in _multicall
res = hook_impl.function(*args)
File "~/.pyenv/versions/3.7.1/lib/python3.7/site-packages/tox/package/__init__.py", line 16, in tox_package
session.package, session.dist = get_package(session)
File "~/.pyenv/versions/3.7.1/lib/python3.7/site-packages/tox/package/__init__.py", line 29, in get_package
package = acquire_package(config, session)
File "~/.pyenv/versions/3.7.1/lib/python3.7/site-packages/tox/package/__init__.py", line 40, in acquire_package
path = build_package(config, session)
File "~/.pyenv/versions/3.7.1/lib/python3.7/site-packages/tox/package/builder/__init__.py", line 9, in build_package
return build(config, session)
File "~/.pyenv/versions/3.7.1/lib/python3.7/site-packages/tox/package/builder/isolated.py", line 34, in build
base_build_deps = {pkg_resources.Requirement(r.name).key for r in package_venv.envconfig.deps}
File "~/.pyenv/versions/3.7.1/lib/python3.7/site-packages/tox/package/builder/isolated.py", line 34, in <setcomp>
base_build_deps = {pkg_resources.Requirement(r.name).key for r in package_venv.envconfig.deps}
File "~/.pyenv/versions/3.7.1/lib/python3.7/site-packages/pkg_resources/__init__.py", line 3044, in __init__
raise RequirementParseError(str(e))
pkg_resources.RequirementParseError: Invalid requirement, parse error at "'-rlint-r'"
|
pkg_resources.RequirementParseError
|
def main(args):
setup_reporter(args)
try:
config = load_config(args)
config.logdir.ensure(dir=1)
ensure_empty_dir(config.logdir)
with set_os_env_var("TOX_WORK_DIR", config.toxworkdir):
session = build_session(config)
exit_code = session.runcommand()
if exit_code is None:
exit_code = 0
raise SystemExit(exit_code)
except tox.exception.BadRequirement:
raise SystemExit(1)
except KeyboardInterrupt:
raise SystemExit(2)
|
def main(args):
setup_reporter(args)
try:
config = load_config(args)
config.logdir.ensure(dir=1)
ensure_empty_dir(config.logdir)
with set_os_env_var("TOX_WORK_DIR", config.toxworkdir):
session = build_session(config)
retcode = session.runcommand()
if retcode is None:
retcode = 0
raise SystemExit(retcode)
except tox.exception.BadRequirement:
raise SystemExit(1)
except KeyboardInterrupt:
raise SystemExit(2)
|
https://github.com/tox-dev/tox/issues/1228
|
========================================================= FAILURES ==========================================================
______________________________________________ test_init_sets_given_attributes ______________________________________________
def test_init_sets_given_attributes():
group = models.Group(name="My group", authority="example.com", enforce_scope=False)
assert False
E assert False
group = <Group: my-group>
tests/h/models/group_test.py:22: AssertionError
========================================== 1 failed, 3503 passed in 78.03 seconds ===========================================
Traceback (most recent call last):
File "/usr/local/bin/tox", line 11, in <module>
sys.exit(cmdline())
File "/usr/local/lib/python2.7/dist-packages/tox/session/__init__.py", line 42, in cmdline
main(args)
File "/usr/local/lib/python2.7/dist-packages/tox/session/__init__.py", line 63, in main
retcode = session.runcommand()
File "/usr/local/lib/python2.7/dist-packages/tox/session/__init__.py", line 177, in runcommand
provision_tox(provision_tox_venv, self.config.args)
File "/usr/local/lib/python2.7/dist-packages/tox/session/commands/provision.py", line 9, in provision_tox
action.popen(provision_args, redirect=False)
File "/usr/local/lib/python2.7/dist-packages/tox/action.py", line 121, in popen
raise InvocationError(cmd_args_shell, exit_code, output)
tox.exception.InvocationError: InvocationError for command /home/seanh/Projects/h/.tox/.tox/bin/python -m tox -qqq (exited with code 1)
|
tox.exception.InvocationError
|
def runcommand(self):
reporter.using(
"tox-{} from {} (pid {})".format(tox.__version__, tox.__file__, os.getpid())
)
show_description = reporter.has_level(reporter.Verbosity.DEFAULT)
if self.config.run_provision:
provision_tox_venv = self.getvenv(self.config.provision_tox_env)
return provision_tox(provision_tox_venv, self.config.args)
else:
if self.config.option.showconfig:
self.showconfig()
elif self.config.option.listenvs:
self.showenvs(all_envs=False, description=show_description)
elif self.config.option.listenvs_all:
self.showenvs(all_envs=True, description=show_description)
else:
with self.cleanup():
return self.subcommand_test()
|
def runcommand(self):
reporter.using(
"tox-{} from {} (pid {})".format(tox.__version__, tox.__file__, os.getpid())
)
show_description = reporter.has_level(reporter.Verbosity.DEFAULT)
if self.config.run_provision:
provision_tox_venv = self.getvenv(self.config.provision_tox_env)
provision_tox(provision_tox_venv, self.config.args)
else:
if self.config.option.showconfig:
self.showconfig()
elif self.config.option.listenvs:
self.showenvs(all_envs=False, description=show_description)
elif self.config.option.listenvs_all:
self.showenvs(all_envs=True, description=show_description)
else:
with self.cleanup():
return self.subcommand_test()
|
https://github.com/tox-dev/tox/issues/1228
|
========================================================= FAILURES ==========================================================
______________________________________________ test_init_sets_given_attributes ______________________________________________
def test_init_sets_given_attributes():
group = models.Group(name="My group", authority="example.com", enforce_scope=False)
assert False
E assert False
group = <Group: my-group>
tests/h/models/group_test.py:22: AssertionError
========================================== 1 failed, 3503 passed in 78.03 seconds ===========================================
Traceback (most recent call last):
File "/usr/local/bin/tox", line 11, in <module>
sys.exit(cmdline())
File "/usr/local/lib/python2.7/dist-packages/tox/session/__init__.py", line 42, in cmdline
main(args)
File "/usr/local/lib/python2.7/dist-packages/tox/session/__init__.py", line 63, in main
retcode = session.runcommand()
File "/usr/local/lib/python2.7/dist-packages/tox/session/__init__.py", line 177, in runcommand
provision_tox(provision_tox_venv, self.config.args)
File "/usr/local/lib/python2.7/dist-packages/tox/session/commands/provision.py", line 9, in provision_tox
action.popen(provision_args, redirect=False)
File "/usr/local/lib/python2.7/dist-packages/tox/action.py", line 121, in popen
raise InvocationError(cmd_args_shell, exit_code, output)
tox.exception.InvocationError: InvocationError for command /home/seanh/Projects/h/.tox/.tox/bin/python -m tox -qqq (exited with code 1)
|
tox.exception.InvocationError
|
def provision_tox(provision_venv, args):
ensure_meta_env_up_to_date(provision_venv)
with provision_venv.new_action("provision") as action:
provision_args = [str(provision_venv.envconfig.envpython), "-m", "tox"] + args
try:
action.popen(provision_args, redirect=False, report_fail=False)
return 0
except InvocationError as exception:
return exception.exit_code
|
def provision_tox(provision_venv, args):
ensure_meta_env_up_to_date(provision_venv)
with provision_venv.new_action("provision") as action:
provision_args = [str(provision_venv.envconfig.envpython), "-m", "tox"] + args
action.popen(provision_args, redirect=False)
|
https://github.com/tox-dev/tox/issues/1228
|
========================================================= FAILURES ==========================================================
______________________________________________ test_init_sets_given_attributes ______________________________________________
def test_init_sets_given_attributes():
group = models.Group(name="My group", authority="example.com", enforce_scope=False)
assert False
E assert False
group = <Group: my-group>
tests/h/models/group_test.py:22: AssertionError
========================================== 1 failed, 3503 passed in 78.03 seconds ===========================================
Traceback (most recent call last):
File "/usr/local/bin/tox", line 11, in <module>
sys.exit(cmdline())
File "/usr/local/lib/python2.7/dist-packages/tox/session/__init__.py", line 42, in cmdline
main(args)
File "/usr/local/lib/python2.7/dist-packages/tox/session/__init__.py", line 63, in main
retcode = session.runcommand()
File "/usr/local/lib/python2.7/dist-packages/tox/session/__init__.py", line 177, in runcommand
provision_tox(provision_tox_venv, self.config.args)
File "/usr/local/lib/python2.7/dist-packages/tox/session/commands/provision.py", line 9, in provision_tox
action.popen(provision_args, redirect=False)
File "/usr/local/lib/python2.7/dist-packages/tox/action.py", line 121, in popen
raise InvocationError(cmd_args_shell, exit_code, output)
tox.exception.InvocationError: InvocationError for command /home/seanh/Projects/h/.tox/.tox/bin/python -m tox -qqq (exited with code 1)
|
tox.exception.InvocationError
|
def tox_addoption(parser):
parser.add_argument(
"--version",
action="store_true",
dest="version",
help="report version information to stdout.",
)
parser.add_argument(
"-h", "--help", action="store_true", dest="help", help="show help about options"
)
parser.add_argument(
"--help-ini",
"--hi",
action="store_true",
dest="helpini",
help="show help about ini-names",
)
add_verbosity_commands(parser)
parser.add_argument(
"--showconfig",
action="store_true",
help="show configuration information for all environments. ",
)
parser.add_argument(
"-l",
"--listenvs",
action="store_true",
dest="listenvs",
help="show list of test environments (with description if verbose)",
)
parser.add_argument(
"-a",
"--listenvs-all",
action="store_true",
dest="listenvs_all",
help="show list of all defined environments (with description if verbose)",
)
parser.add_argument(
"-c",
action="store",
default=None,
dest="configfile",
help="config file name or directory with 'tox.ini' file.",
)
parser.add_argument(
"-e",
action="append",
dest="env",
metavar="envlist",
help="work against specified environments (ALL selects all).",
)
parser.add_argument(
"--notest",
action="store_true",
dest="notest",
help="skip invoking test commands.",
)
parser.add_argument(
"--sdistonly",
action="store_true",
dest="sdistonly",
help="only perform the sdist packaging activity.",
)
add_parallel_flags(parser)
parser.add_argument(
"--parallel--safe-build",
action="store_true",
dest="parallel_safe_build",
help="(deprecated) ensure two tox builds can run in parallel "
"(uses a lock file in the tox workdir with .lock extension)",
)
parser.add_argument(
"--installpkg",
action="store",
default=None,
metavar="PATH",
help="use specified package for installation into venv, instead of creating an sdist.",
)
parser.add_argument(
"--develop",
action="store_true",
dest="develop",
help="install package in the venv using 'setup.py develop' via 'pip -e .'",
)
parser.add_argument(
"-i",
"--index-url",
action="append",
dest="indexurl",
metavar="URL",
help="set indexserver url (if URL is of form name=url set the "
"url for the 'name' indexserver, specifically)",
)
parser.add_argument(
"--pre",
action="store_true",
dest="pre",
help="install pre-releases and development versions of dependencies. "
"This will pass the --pre option to install_command "
"(pip by default).",
)
parser.add_argument(
"-r",
"--recreate",
action="store_true",
dest="recreate",
help="force recreation of virtual environments",
)
parser.add_argument(
"--result-json",
action="store",
dest="resultjson",
metavar="PATH",
help="write a json file with detailed information "
"about all commands and results involved.",
)
# We choose 1 to 4294967295 because it is the range of PYTHONHASHSEED.
parser.add_argument(
"--hashseed",
action="store",
metavar="SEED",
default=None,
help="set PYTHONHASHSEED to SEED before running commands. "
"Defaults to a random integer in the range [1, 4294967295] "
"([1, 1024] on Windows). "
"Passing 'noset' suppresses this behavior.",
)
parser.add_argument(
"--force-dep",
action="append",
metavar="REQ",
default=None,
help="Forces a certain version of one of the dependencies "
"when configuring the virtual environment. REQ Examples "
"'pytest<2.7' or 'django>=1.6'.",
)
parser.add_argument(
"--sitepackages",
action="store_true",
help="override sitepackages setting to True in all envs",
)
parser.add_argument(
"--alwayscopy",
action="store_true",
help="override alwayscopy setting to True in all envs",
)
cli_skip_missing_interpreter(parser)
parser.add_argument(
"--workdir",
action="store",
dest="workdir",
metavar="PATH",
default=None,
help="tox working directory",
)
parser.add_argument(
"args",
nargs="*",
help="additional arguments available to command positional substitution",
)
parser.add_testenv_attribute(
name="envdir",
type="path",
default="{toxworkdir}/{envname}",
help="set venv directory -- be very careful when changing this as tox "
"will remove this directory when recreating an environment",
)
# add various core venv interpreter attributes
def setenv(testenv_config, value):
setenv = value
config = testenv_config.config
if "PYTHONHASHSEED" not in setenv and config.hashseed is not None:
setenv["PYTHONHASHSEED"] = config.hashseed
setenv["TOX_ENV_NAME"] = str(testenv_config.envname)
setenv["TOX_ENV_DIR"] = str(testenv_config.envdir)
return setenv
parser.add_testenv_attribute(
name="setenv",
type="dict_setenv",
postprocess=setenv,
help="list of X=Y lines with environment variable settings",
)
def basepython_default(testenv_config, value):
"""either user set or proposed from the factor name
in both cases we check that the factor name implied python version and the resolved
python interpreter version match up; if they don't we warn, unless ignore base
python conflict is set in which case the factor name implied version if forced
"""
for factor in testenv_config.factors:
if factor in tox.PYTHON.DEFAULT_FACTORS:
implied_python = tox.PYTHON.DEFAULT_FACTORS[factor]
break
else:
implied_python, factor = None, None
if (
testenv_config.config.ignore_basepython_conflict
and implied_python is not None
):
return implied_python
proposed_python = (
(implied_python or sys.executable) if value is None else str(value)
)
if implied_python is not None and implied_python != proposed_python:
testenv_config.basepython = proposed_python
match = tox.PYTHON.PY_FACTORS_RE.match(factor)
implied_version = match.group(2) if match else None
if implied_version is not None:
python_info_for_proposed = testenv_config.python_info
if not isinstance(python_info_for_proposed, NoInterpreterInfo):
proposed_version = "".join(
str(i) for i in python_info_for_proposed.version_info[0:2]
)
# '27'.startswith('2') or '27'.startswith('27')
if not proposed_version.startswith(implied_version):
# TODO(stephenfin): Raise an exception here in tox 4.0
warnings.warn(
"conflicting basepython version (set {}, should be {}) for env '{}';"
"resolve conflict or set ignore_basepython_conflict".format(
proposed_version,
implied_version,
testenv_config.envname,
)
)
return proposed_python
parser.add_testenv_attribute(
name="basepython",
type="basepython",
default=None,
postprocess=basepython_default,
help="executable name or path of interpreter used to create a virtual test environment.",
)
def merge_description(testenv_config, value):
"""the reader by default joins generated description with new line,
replace new line with space"""
return value.replace("\n", " ")
parser.add_testenv_attribute(
name="description",
type="string",
default="",
postprocess=merge_description,
help="short description of this environment",
)
parser.add_testenv_attribute(
name="envtmpdir",
type="path",
default="{envdir}/tmp",
help="venv temporary directory",
)
parser.add_testenv_attribute(
name="envlogdir", type="path", default="{envdir}/log", help="venv log directory"
)
parser.add_testenv_attribute(
name="downloadcache",
type="string",
default=None,
help="(ignored) has no effect anymore, pip-8 uses local caching by default",
)
parser.add_testenv_attribute(
name="changedir",
type="path",
default="{toxinidir}",
help="directory to change to when running commands",
)
parser.add_testenv_attribute_obj(PosargsOption())
parser.add_testenv_attribute(
name="skip_install",
type="bool",
default=False,
help="Do not install the current package. This can be used when you need the virtualenv "
"management but do not want to install the current package",
)
parser.add_testenv_attribute(
name="ignore_errors",
type="bool",
default=False,
help="if set to True all commands will be executed irrespective of their result error "
"status.",
)
def recreate(testenv_config, value):
if testenv_config.config.option.recreate:
return True
return value
parser.add_testenv_attribute(
name="recreate",
type="bool",
default=False,
postprocess=recreate,
help="always recreate this test environment.",
)
def passenv(testenv_config, value):
# Flatten the list to deal with space-separated values.
value = list(itertools.chain.from_iterable([x.split(" ") for x in value]))
passenv = {
"PATH",
"PIP_INDEX_URL",
"LANG",
"LANGUAGE",
"LD_LIBRARY_PATH",
"TOX_WORK_DIR",
str(REPORTER_TIMESTAMP_ON_ENV),
str(PARALLEL_ENV_VAR_KEY),
}
# read in global passenv settings
p = os.environ.get("TOX_TESTENV_PASSENV", None)
if p is not None:
env_values = [x for x in p.split() if x]
value.extend(env_values)
# we ensure that tmp directory settings are passed on
# we could also set it to the per-venv "envtmpdir"
# but this leads to very long paths when run with jenkins
# so we just pass it on by default for now.
if tox.INFO.IS_WIN:
passenv.add("SYSTEMDRIVE") # needed for pip6
passenv.add("SYSTEMROOT") # needed for python's crypto module
passenv.add("PATHEXT") # needed for discovering executables
passenv.add("COMSPEC") # needed for distutils cygwincompiler
passenv.add("TEMP")
passenv.add("TMP")
# for `multiprocessing.cpu_count()` on Windows (prior to Python 3.4).
passenv.add("NUMBER_OF_PROCESSORS")
passenv.add("PROCESSOR_ARCHITECTURE") # platform.machine()
passenv.add("USERPROFILE") # needed for `os.path.expanduser()`
passenv.add("MSYSTEM") # fixes #429
else:
passenv.add("TMPDIR")
for spec in value:
for name in os.environ:
if fnmatchcase(name.upper(), spec.upper()):
passenv.add(name)
return passenv
parser.add_testenv_attribute(
name="passenv",
type="line-list",
postprocess=passenv,
help="environment variables needed during executing test commands (taken from invocation "
"environment). Note that tox always passes through some basic environment variables "
"which are needed for basic functioning of the Python system. See --showconfig for the "
"eventual passenv setting.",
)
parser.add_testenv_attribute(
name="whitelist_externals",
type="line-list",
help="each lines specifies a path or basename for which tox will not warn "
"about it coming from outside the test environment.",
)
parser.add_testenv_attribute(
name="platform",
type="string",
default=".*",
help="regular expression which must match against ``sys.platform``. "
"otherwise testenv will be skipped.",
)
def sitepackages(testenv_config, value):
return testenv_config.config.option.sitepackages or value
def alwayscopy(testenv_config, value):
return testenv_config.config.option.alwayscopy or value
parser.add_testenv_attribute(
name="sitepackages",
type="bool",
default=False,
postprocess=sitepackages,
help="Set to ``True`` if you want to create virtual environments that also "
"have access to globally installed packages.",
)
parser.add_testenv_attribute(
name="alwayscopy",
type="bool",
default=False,
postprocess=alwayscopy,
help="Set to ``True`` if you want virtualenv to always copy files rather "
"than symlinking.",
)
def pip_pre(testenv_config, value):
return testenv_config.config.option.pre or value
parser.add_testenv_attribute(
name="pip_pre",
type="bool",
default=False,
postprocess=pip_pre,
help="If ``True``, adds ``--pre`` to the ``opts`` passed to the install command. ",
)
def develop(testenv_config, value):
option = testenv_config.config.option
return not option.installpkg and (value or option.develop)
parser.add_testenv_attribute(
name="usedevelop",
type="bool",
postprocess=develop,
default=False,
help="install package in develop/editable mode",
)
parser.add_testenv_attribute_obj(InstallcmdOption())
parser.add_testenv_attribute(
name="list_dependencies_command",
type="argv",
default="python -m pip freeze",
help="list dependencies for a virtual environment",
)
parser.add_testenv_attribute_obj(DepOption())
parser.add_testenv_attribute(
name="commands",
type="argvlist",
default="",
help="each line specifies a test command and can use substitution.",
)
parser.add_testenv_attribute(
name="commands_pre",
type="argvlist",
default="",
help="each line specifies a setup command action and can use substitution.",
)
parser.add_testenv_attribute(
name="commands_post",
type="argvlist",
default="",
help="each line specifies a teardown command and can use substitution.",
)
parser.add_testenv_attribute(
"ignore_outcome",
type="bool",
default=False,
help="if set to True a failing result of this testenv will not make "
"tox fail, only a warning will be produced",
)
parser.add_testenv_attribute(
"extras",
type="line-list",
help="list of extras to install with the source distribution or develop install",
)
add_parallel_config(parser)
|
def tox_addoption(parser):
parser.add_argument(
"--version",
action="store_true",
dest="version",
help="report version information to stdout.",
)
parser.add_argument(
"-h", "--help", action="store_true", dest="help", help="show help about options"
)
parser.add_argument(
"--help-ini",
"--hi",
action="store_true",
dest="helpini",
help="show help about ini-names",
)
add_verbosity_commands(parser)
parser.add_argument(
"--showconfig",
action="store_true",
help="show configuration information for all environments. ",
)
parser.add_argument(
"-l",
"--listenvs",
action="store_true",
dest="listenvs",
help="show list of test environments (with description if verbose)",
)
parser.add_argument(
"-a",
"--listenvs-all",
action="store_true",
dest="listenvs_all",
help="show list of all defined environments (with description if verbose)",
)
parser.add_argument(
"-c",
action="store",
default=None,
dest="configfile",
help="config file name or directory with 'tox.ini' file.",
)
parser.add_argument(
"-e",
action="append",
dest="env",
metavar="envlist",
help="work against specified environments (ALL selects all).",
)
parser.add_argument(
"--notest",
action="store_true",
dest="notest",
help="skip invoking test commands.",
)
parser.add_argument(
"--sdistonly",
action="store_true",
dest="sdistonly",
help="only perform the sdist packaging activity.",
)
add_parallel_flags(parser)
parser.add_argument(
"--parallel--safe-build",
action="store_true",
dest="parallel_safe_build",
help="(deprecated) ensure two tox builds can run in parallel "
"(uses a lock file in the tox workdir with .lock extension)",
)
parser.add_argument(
"--installpkg",
action="store",
default=None,
metavar="PATH",
help="use specified package for installation into venv, instead of creating an sdist.",
)
parser.add_argument(
"--develop",
action="store_true",
dest="develop",
help="install package in the venv using 'setup.py develop' via 'pip -e .'",
)
parser.add_argument(
"-i",
"--index-url",
action="append",
dest="indexurl",
metavar="URL",
help="set indexserver url (if URL is of form name=url set the "
"url for the 'name' indexserver, specifically)",
)
parser.add_argument(
"--pre",
action="store_true",
dest="pre",
help="install pre-releases and development versions of dependencies. "
"This will pass the --pre option to install_command "
"(pip by default).",
)
parser.add_argument(
"-r",
"--recreate",
action="store_true",
dest="recreate",
help="force recreation of virtual environments",
)
parser.add_argument(
"--result-json",
action="store",
dest="resultjson",
metavar="PATH",
help="write a json file with detailed information "
"about all commands and results involved.",
)
# We choose 1 to 4294967295 because it is the range of PYTHONHASHSEED.
parser.add_argument(
"--hashseed",
action="store",
metavar="SEED",
default=None,
help="set PYTHONHASHSEED to SEED before running commands. "
"Defaults to a random integer in the range [1, 4294967295] "
"([1, 1024] on Windows). "
"Passing 'noset' suppresses this behavior.",
)
parser.add_argument(
"--force-dep",
action="append",
metavar="REQ",
default=None,
help="Forces a certain version of one of the dependencies "
"when configuring the virtual environment. REQ Examples "
"'pytest<2.7' or 'django>=1.6'.",
)
parser.add_argument(
"--sitepackages",
action="store_true",
help="override sitepackages setting to True in all envs",
)
parser.add_argument(
"--alwayscopy",
action="store_true",
help="override alwayscopy setting to True in all envs",
)
cli_skip_missing_interpreter(parser)
parser.add_argument(
"--workdir",
action="store",
dest="workdir",
metavar="PATH",
default=None,
help="tox working directory",
)
parser.add_argument(
"args",
nargs="*",
help="additional arguments available to command positional substitution",
)
parser.add_testenv_attribute(
name="envdir",
type="path",
default="{toxworkdir}/{envname}",
help="set venv directory -- be very careful when changing this as tox "
"will remove this directory when recreating an environment",
)
# add various core venv interpreter attributes
def setenv(testenv_config, value):
setenv = value
config = testenv_config.config
if "PYTHONHASHSEED" not in setenv and config.hashseed is not None:
setenv["PYTHONHASHSEED"] = config.hashseed
setenv["TOX_ENV_NAME"] = str(testenv_config.envname)
setenv["TOX_ENV_DIR"] = str(testenv_config.envdir)
return setenv
parser.add_testenv_attribute(
name="setenv",
type="dict_setenv",
postprocess=setenv,
help="list of X=Y lines with environment variable settings",
)
def basepython_default(testenv_config, value):
"""either user set or proposed from the factor name
in both cases we check that the factor name implied python version and the resolved
python interpreter version match up; if they don't we warn, unless ignore base
python conflict is set in which case the factor name implied version if forced
"""
for factor in testenv_config.factors:
if factor in tox.PYTHON.DEFAULT_FACTORS:
implied_python = tox.PYTHON.DEFAULT_FACTORS[factor]
break
else:
implied_python, factor = None, None
if (
testenv_config.config.ignore_basepython_conflict
and implied_python is not None
):
return implied_python
proposed_python = (
(implied_python or sys.executable) if value is None else str(value)
)
if implied_python is not None and implied_python != proposed_python:
testenv_config.basepython = proposed_python
implied_version = tox.PYTHON.PY_FACTORS_RE.match(factor).group(2)
python_info_for_proposed = testenv_config.python_info
if not isinstance(python_info_for_proposed, NoInterpreterInfo):
proposed_version = "".join(
str(i) for i in python_info_for_proposed.version_info[0:2]
)
# '27'.startswith('2') or '27'.startswith('27')
if not proposed_version.startswith(implied_version):
# TODO(stephenfin): Raise an exception here in tox 4.0
warnings.warn(
"conflicting basepython version (set {}, should be {}) for env '{}';"
"resolve conflict or set ignore_basepython_conflict".format(
proposed_version, implied_version, testenv_config.envname
)
)
return proposed_python
parser.add_testenv_attribute(
name="basepython",
type="basepython",
default=None,
postprocess=basepython_default,
help="executable name or path of interpreter used to create a virtual test environment.",
)
def merge_description(testenv_config, value):
"""the reader by default joins generated description with new line,
replace new line with space"""
return value.replace("\n", " ")
parser.add_testenv_attribute(
name="description",
type="string",
default="",
postprocess=merge_description,
help="short description of this environment",
)
parser.add_testenv_attribute(
name="envtmpdir",
type="path",
default="{envdir}/tmp",
help="venv temporary directory",
)
parser.add_testenv_attribute(
name="envlogdir", type="path", default="{envdir}/log", help="venv log directory"
)
parser.add_testenv_attribute(
name="downloadcache",
type="string",
default=None,
help="(ignored) has no effect anymore, pip-8 uses local caching by default",
)
parser.add_testenv_attribute(
name="changedir",
type="path",
default="{toxinidir}",
help="directory to change to when running commands",
)
parser.add_testenv_attribute_obj(PosargsOption())
parser.add_testenv_attribute(
name="skip_install",
type="bool",
default=False,
help="Do not install the current package. This can be used when you need the virtualenv "
"management but do not want to install the current package",
)
parser.add_testenv_attribute(
name="ignore_errors",
type="bool",
default=False,
help="if set to True all commands will be executed irrespective of their result error "
"status.",
)
def recreate(testenv_config, value):
if testenv_config.config.option.recreate:
return True
return value
parser.add_testenv_attribute(
name="recreate",
type="bool",
default=False,
postprocess=recreate,
help="always recreate this test environment.",
)
def passenv(testenv_config, value):
# Flatten the list to deal with space-separated values.
value = list(itertools.chain.from_iterable([x.split(" ") for x in value]))
passenv = {
"PATH",
"PIP_INDEX_URL",
"LANG",
"LANGUAGE",
"LD_LIBRARY_PATH",
"TOX_WORK_DIR",
str(REPORTER_TIMESTAMP_ON_ENV),
str(PARALLEL_ENV_VAR_KEY),
}
# read in global passenv settings
p = os.environ.get("TOX_TESTENV_PASSENV", None)
if p is not None:
env_values = [x for x in p.split() if x]
value.extend(env_values)
# we ensure that tmp directory settings are passed on
# we could also set it to the per-venv "envtmpdir"
# but this leads to very long paths when run with jenkins
# so we just pass it on by default for now.
if tox.INFO.IS_WIN:
passenv.add("SYSTEMDRIVE") # needed for pip6
passenv.add("SYSTEMROOT") # needed for python's crypto module
passenv.add("PATHEXT") # needed for discovering executables
passenv.add("COMSPEC") # needed for distutils cygwincompiler
passenv.add("TEMP")
passenv.add("TMP")
# for `multiprocessing.cpu_count()` on Windows (prior to Python 3.4).
passenv.add("NUMBER_OF_PROCESSORS")
passenv.add("PROCESSOR_ARCHITECTURE") # platform.machine()
passenv.add("USERPROFILE") # needed for `os.path.expanduser()`
passenv.add("MSYSTEM") # fixes #429
else:
passenv.add("TMPDIR")
for spec in value:
for name in os.environ:
if fnmatchcase(name.upper(), spec.upper()):
passenv.add(name)
return passenv
parser.add_testenv_attribute(
name="passenv",
type="line-list",
postprocess=passenv,
help="environment variables needed during executing test commands (taken from invocation "
"environment). Note that tox always passes through some basic environment variables "
"which are needed for basic functioning of the Python system. See --showconfig for the "
"eventual passenv setting.",
)
parser.add_testenv_attribute(
name="whitelist_externals",
type="line-list",
help="each lines specifies a path or basename for which tox will not warn "
"about it coming from outside the test environment.",
)
parser.add_testenv_attribute(
name="platform",
type="string",
default=".*",
help="regular expression which must match against ``sys.platform``. "
"otherwise testenv will be skipped.",
)
def sitepackages(testenv_config, value):
return testenv_config.config.option.sitepackages or value
def alwayscopy(testenv_config, value):
return testenv_config.config.option.alwayscopy or value
parser.add_testenv_attribute(
name="sitepackages",
type="bool",
default=False,
postprocess=sitepackages,
help="Set to ``True`` if you want to create virtual environments that also "
"have access to globally installed packages.",
)
parser.add_testenv_attribute(
name="alwayscopy",
type="bool",
default=False,
postprocess=alwayscopy,
help="Set to ``True`` if you want virtualenv to always copy files rather "
"than symlinking.",
)
def pip_pre(testenv_config, value):
return testenv_config.config.option.pre or value
parser.add_testenv_attribute(
name="pip_pre",
type="bool",
default=False,
postprocess=pip_pre,
help="If ``True``, adds ``--pre`` to the ``opts`` passed to the install command. ",
)
def develop(testenv_config, value):
option = testenv_config.config.option
return not option.installpkg and (value or option.develop)
parser.add_testenv_attribute(
name="usedevelop",
type="bool",
postprocess=develop,
default=False,
help="install package in develop/editable mode",
)
parser.add_testenv_attribute_obj(InstallcmdOption())
parser.add_testenv_attribute(
name="list_dependencies_command",
type="argv",
default="python -m pip freeze",
help="list dependencies for a virtual environment",
)
parser.add_testenv_attribute_obj(DepOption())
parser.add_testenv_attribute(
name="commands",
type="argvlist",
default="",
help="each line specifies a test command and can use substitution.",
)
parser.add_testenv_attribute(
name="commands_pre",
type="argvlist",
default="",
help="each line specifies a setup command action and can use substitution.",
)
parser.add_testenv_attribute(
name="commands_post",
type="argvlist",
default="",
help="each line specifies a teardown command and can use substitution.",
)
parser.add_testenv_attribute(
"ignore_outcome",
type="bool",
default=False,
help="if set to True a failing result of this testenv will not make "
"tox fail, only a warning will be produced",
)
parser.add_testenv_attribute(
"extras",
type="line-list",
help="list of extras to install with the source distribution or develop install",
)
add_parallel_config(parser)
|
https://github.com/tox-dev/tox/issues/1227
|
ci\appveyor\build.cmd py -3.5 -m tox
Using default MSVC build environment
C:\Python35-x64\lib\site-packages\tox\config\__init__.py:576: UserWarning: conflicting basepython version (set 36, should be 27) for env 'py27-test-deps';resolve conflict or set ignore_basepython_conflict
proposed_version, implied_version, testenv_config.envname
C:\Python35-x64\lib\site-packages\tox\config\__init__.py:576: UserWarning: conflicting basepython version (set 36, should be 27) for env 'py27-test-mindeps';resolve conflict or set ignore_basepython_conflict
proposed_version, implied_version, testenv_config.envname
C:\Python35-x64\lib\site-packages\tox\config\__init__.py:576: UserWarning: conflicting basepython version (set 36, should be 34) for env 'py34-test-deps';resolve conflict or set ignore_basepython_conflict
proposed_version, implied_version, testenv_config.envname
C:\Python35-x64\lib\site-packages\tox\config\__init__.py:576: UserWarning: conflicting basepython version (set 36, should be 34) for env 'py34-test-mindeps';resolve conflict or set ignore_basepython_conflict
proposed_version, implied_version, testenv_config.envname
C:\Python35-x64\lib\site-packages\tox\config\__init__.py:576: UserWarning: conflicting basepython version (set 36, should be 35) for env 'py35-test-deps';resolve conflict or set ignore_basepython_conflict
proposed_version, implied_version, testenv_config.envname
C:\Python35-x64\lib\site-packages\tox\config\__init__.py:576: UserWarning: conflicting basepython version (set 36, should be 35) for env 'py35-test-mindeps';resolve conflict or set ignore_basepython_conflict
proposed_version, implied_version, testenv_config.envname
C:\Python35-x64\lib\site-packages\tox\config\__init__.py:576: UserWarning: conflicting basepython version (set 36, should be 37) for env 'py37-test-deps';resolve conflict or set ignore_basepython_conflict
proposed_version, implied_version, testenv_config.envname
C:\Python35-x64\lib\site-packages\tox\config\__init__.py:576: UserWarning: conflicting basepython version (set 36, should be 37) for env 'py37-test-mindeps';resolve conflict or set ignore_basepython_conflict
proposed_version, implied_version, testenv_config.envname
Traceback (most recent call last):
File "C:\Python35-x64\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "C:\Python35-x64\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Python35-x64\lib\site-packages\tox\__main__.py", line 4, in <module>
tox.cmdline()
File "C:\Python35-x64\lib\site-packages\tox\session\__init__.py", line 42, in cmdline
main(args)
File "C:\Python35-x64\lib\site-packages\tox\session\__init__.py", line 58, in main
config = load_config(args)
File "C:\Python35-x64\lib\site-packages\tox\session\__init__.py", line 75, in load_config
config = parseconfig(args)
File "C:\Python35-x64\lib\site-packages\tox\config\__init__.py", line 249, in parseconfig
ParseIni(config, config_file, content)
File "C:\Python35-x64\lib\site-packages\tox\config\__init__.py", line 1077, in __init__
config.envconfigs[name] = self.make_envconfig(name, section, reader._subs, config)
File "C:\Python35-x64\lib\site-packages\tox\config\__init__.py", line 1181, in make_envconfig
res = env_attr.postprocess(testenv_config=tc, value=res)
File "C:\Python35-x64\lib\site-packages\tox\config\__init__.py", line 571, in basepython_default
if not proposed_version.startswith(implied_version):
TypeError: startswith first arg must be str or a tuple of str, not NoneType
|
TypeError
|
def basepython_default(testenv_config, value):
"""either user set or proposed from the factor name
in both cases we check that the factor name implied python version and the resolved
python interpreter version match up; if they don't we warn, unless ignore base
python conflict is set in which case the factor name implied version if forced
"""
for factor in testenv_config.factors:
if factor in tox.PYTHON.DEFAULT_FACTORS:
implied_python = tox.PYTHON.DEFAULT_FACTORS[factor]
break
else:
implied_python, factor = None, None
if testenv_config.config.ignore_basepython_conflict and implied_python is not None:
return implied_python
proposed_python = (
(implied_python or sys.executable) if value is None else str(value)
)
if implied_python is not None and implied_python != proposed_python:
testenv_config.basepython = proposed_python
match = tox.PYTHON.PY_FACTORS_RE.match(factor)
implied_version = match.group(2) if match else None
if implied_version is not None:
python_info_for_proposed = testenv_config.python_info
if not isinstance(python_info_for_proposed, NoInterpreterInfo):
proposed_version = "".join(
str(i) for i in python_info_for_proposed.version_info[0:2]
)
# '27'.startswith('2') or '27'.startswith('27')
if not proposed_version.startswith(implied_version):
# TODO(stephenfin): Raise an exception here in tox 4.0
warnings.warn(
"conflicting basepython version (set {}, should be {}) for env '{}';"
"resolve conflict or set ignore_basepython_conflict".format(
proposed_version, implied_version, testenv_config.envname
)
)
return proposed_python
|
def basepython_default(testenv_config, value):
"""either user set or proposed from the factor name
in both cases we check that the factor name implied python version and the resolved
python interpreter version match up; if they don't we warn, unless ignore base
python conflict is set in which case the factor name implied version if forced
"""
for factor in testenv_config.factors:
if factor in tox.PYTHON.DEFAULT_FACTORS:
implied_python = tox.PYTHON.DEFAULT_FACTORS[factor]
break
else:
implied_python, factor = None, None
if testenv_config.config.ignore_basepython_conflict and implied_python is not None:
return implied_python
proposed_python = (
(implied_python or sys.executable) if value is None else str(value)
)
if implied_python is not None and implied_python != proposed_python:
testenv_config.basepython = proposed_python
implied_version = tox.PYTHON.PY_FACTORS_RE.match(factor).group(2)
python_info_for_proposed = testenv_config.python_info
if not isinstance(python_info_for_proposed, NoInterpreterInfo):
proposed_version = "".join(
str(i) for i in python_info_for_proposed.version_info[0:2]
)
# '27'.startswith('2') or '27'.startswith('27')
if not proposed_version.startswith(implied_version):
# TODO(stephenfin): Raise an exception here in tox 4.0
warnings.warn(
"conflicting basepython version (set {}, should be {}) for env '{}';"
"resolve conflict or set ignore_basepython_conflict".format(
proposed_version, implied_version, testenv_config.envname
)
)
return proposed_python
|
https://github.com/tox-dev/tox/issues/1227
|
ci\appveyor\build.cmd py -3.5 -m tox
Using default MSVC build environment
C:\Python35-x64\lib\site-packages\tox\config\__init__.py:576: UserWarning: conflicting basepython version (set 36, should be 27) for env 'py27-test-deps';resolve conflict or set ignore_basepython_conflict
proposed_version, implied_version, testenv_config.envname
C:\Python35-x64\lib\site-packages\tox\config\__init__.py:576: UserWarning: conflicting basepython version (set 36, should be 27) for env 'py27-test-mindeps';resolve conflict or set ignore_basepython_conflict
proposed_version, implied_version, testenv_config.envname
C:\Python35-x64\lib\site-packages\tox\config\__init__.py:576: UserWarning: conflicting basepython version (set 36, should be 34) for env 'py34-test-deps';resolve conflict or set ignore_basepython_conflict
proposed_version, implied_version, testenv_config.envname
C:\Python35-x64\lib\site-packages\tox\config\__init__.py:576: UserWarning: conflicting basepython version (set 36, should be 34) for env 'py34-test-mindeps';resolve conflict or set ignore_basepython_conflict
proposed_version, implied_version, testenv_config.envname
C:\Python35-x64\lib\site-packages\tox\config\__init__.py:576: UserWarning: conflicting basepython version (set 36, should be 35) for env 'py35-test-deps';resolve conflict or set ignore_basepython_conflict
proposed_version, implied_version, testenv_config.envname
C:\Python35-x64\lib\site-packages\tox\config\__init__.py:576: UserWarning: conflicting basepython version (set 36, should be 35) for env 'py35-test-mindeps';resolve conflict or set ignore_basepython_conflict
proposed_version, implied_version, testenv_config.envname
C:\Python35-x64\lib\site-packages\tox\config\__init__.py:576: UserWarning: conflicting basepython version (set 36, should be 37) for env 'py37-test-deps';resolve conflict or set ignore_basepython_conflict
proposed_version, implied_version, testenv_config.envname
C:\Python35-x64\lib\site-packages\tox\config\__init__.py:576: UserWarning: conflicting basepython version (set 36, should be 37) for env 'py37-test-mindeps';resolve conflict or set ignore_basepython_conflict
proposed_version, implied_version, testenv_config.envname
Traceback (most recent call last):
File "C:\Python35-x64\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "C:\Python35-x64\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Python35-x64\lib\site-packages\tox\__main__.py", line 4, in <module>
tox.cmdline()
File "C:\Python35-x64\lib\site-packages\tox\session\__init__.py", line 42, in cmdline
main(args)
File "C:\Python35-x64\lib\site-packages\tox\session\__init__.py", line 58, in main
config = load_config(args)
File "C:\Python35-x64\lib\site-packages\tox\session\__init__.py", line 75, in load_config
config = parseconfig(args)
File "C:\Python35-x64\lib\site-packages\tox\config\__init__.py", line 249, in parseconfig
ParseIni(config, config_file, content)
File "C:\Python35-x64\lib\site-packages\tox\config\__init__.py", line 1077, in __init__
config.envconfigs[name] = self.make_envconfig(name, section, reader._subs, config)
File "C:\Python35-x64\lib\site-packages\tox\config\__init__.py", line 1181, in make_envconfig
res = env_attr.postprocess(testenv_config=tc, value=res)
File "C:\Python35-x64\lib\site-packages\tox\config\__init__.py", line 571, in basepython_default
if not proposed_version.startswith(implied_version):
TypeError: startswith first arg must be str or a tuple of str, not NoneType
|
TypeError
|
def _file_support_encoding(chars, file):
encoding = getattr(file, "encoding", None)
if encoding is not None:
for char in chars:
try:
char.encode(encoding)
except UnicodeEncodeError:
break
else:
return True
return False
|
def _file_support_encoding(chars, file):
encoding = getattr(file, "encoding", None)
if encoding is not None:
for char in chars:
try:
char.encode(encoding)
except UnicodeDecodeError:
break
else:
return True
return False
|
https://github.com/tox-dev/tox/issues/1223
|
Traceback (most recent call last):
File "/usr/local/bin/tox", line 11, in <module>
sys.exit(cmdline())
File "/usr/local/lib/python3.5/dist-packages/tox/session/__init__.py", line 42, in cmdline
main(args)
File "/usr/local/lib/python3.5/dist-packages/tox/session/__init__.py", line 63, in main
retcode = session.runcommand()
File "/usr/local/lib/python3.5/dist-packages/tox/session/__init__.py", line 187, in runcommand
return self.subcommand_test()
File "/usr/local/lib/python3.5/dist-packages/tox/session/__init__.py", line 213, in subcommand_test
run_parallel(self.config, self.venv_dict)
File "/usr/local/lib/python3.5/dist-packages/tox/session/commands/run/parallel.py", line 29, in run_parallel
with Spinner(enabled=show_progress) as spinner:
File "/usr/local/lib/python3.5/dist-packages/tox/util/spinner.py", line 47, in __init__
if _file_support_encoding(self.UNICODE_FRAMES, sys.stdout)
File "/usr/local/lib/python3.5/dist-packages/tox/util/spinner.py", line 27, in _file_support_encoding
char.encode(encoding)
UnicodeEncodeError: 'ascii' codec can't encode character '\u280b' in position 0: ordinal not in range(128)
|
UnicodeEncodeError
|
def _needs_reinstall(self, setupdir, action):
setup_py = setupdir.join("setup.py")
setup_cfg = setupdir.join("setup.cfg")
args = [self.envconfig.envpython, str(setup_py), "--name"]
env = self._get_os_environ()
output = action.popen(args, cwd=setupdir, redirect=False, returnout=True, env=env)
name = output.strip()
args = [self.envconfig.envpython, "-c", "import sys; print(sys.path)"]
out = action.popen(args, redirect=False, returnout=True, env=env)
try:
sys_path = ast.literal_eval(out.strip())
except SyntaxError:
sys_path = []
egg_info_fname = ".".join((name, "egg-info"))
for d in reversed(sys_path):
egg_info = py.path.local(d).join(egg_info_fname)
if egg_info.check():
break
else:
return True
needs_reinstall = any(
conf_file.check() and conf_file.mtime() > egg_info.mtime()
for conf_file in (setup_py, setup_cfg)
)
# Ensure the modification time of the egg-info folder is updated so we
# won't need to do this again.
# TODO(stephenfin): Remove once the minimum version of setuptools is
# high enough to include https://github.com/pypa/setuptools/pull/1427/
if needs_reinstall:
egg_info.setmtime()
return needs_reinstall
|
def _needs_reinstall(self, setupdir, action):
setup_py = setupdir.join("setup.py")
setup_cfg = setupdir.join("setup.cfg")
args = [self.envconfig.envpython, str(setup_py), "--name"]
env = self._getenv()
output = action.popen(args, cwd=setupdir, redirect=False, returnout=True, env=env)
name = output.strip()
args = [self.envconfig.envpython, "-c", "import sys; print(sys.path)"]
out = action.popen(args, redirect=False, returnout=True, env=env)
try:
sys_path = ast.literal_eval(out.strip())
except SyntaxError:
sys_path = []
egg_info_fname = ".".join((name, "egg-info"))
for d in reversed(sys_path):
egg_info = py.path.local(d).join(egg_info_fname)
if egg_info.check():
break
else:
return True
needs_reinstall = any(
conf_file.check() and conf_file.mtime() > egg_info.mtime()
for conf_file in (setup_py, setup_cfg)
)
# Ensure the modification time of the egg-info folder is updated so we
# won't need to do this again.
# TODO(stephenfin): Remove once the minimum version of setuptools is
# high enough to include https://github.com/pypa/setuptools/pull/1427/
if needs_reinstall:
egg_info.setmtime()
return needs_reinstall
|
https://github.com/tox-dev/tox/issues/838
|
GLOB sdist-make: /tmp/foo/setup.py
py36 inst-nodeps: /tmp/foo/.tox/dist/foo-0.0.0.zip
ERROR: invocation failed (exit code 1), logfile: /tmp/foo/.tox/py36/log/py36-3.log
ERROR: actionid: py36
msg: installpkg
cmdargs: ['/tmp/foo/.tox/py36/bin/pip', 'install', '-U', '--no-deps', '/tmp/foo/.tox/dist/foo-0.0.0.zip']
Can not perform a '--user' install. User site-packages are not visible in this virtualenv.
Exception information:
Traceback (most recent call last):
File "/tmp/foo/.tox/py36/lib/python3.6/site-packages/pip/_internal/basecommand.py", line 228, in main
status = self.run(options, args)
File "/tmp/foo/.tox/py36/lib/python3.6/site-packages/pip/_internal/commands/install.py", line 218, in run
"Can not perform a '--user' install. User site-packages "
pip._internal.exceptions.InstallationError: Can not perform a '--user' install. User site-packages are not visible in this virtualenv.
py36 installed: foo==0.0.0
_____________________________________________________________________________________________ summary ______________________________________________________________________________________________
ERROR: py36: InvocationError for command /tmp/foo/.tox/py36/bin/pip install -U --no-deps /tmp/foo/.tox/dist/foo-0.0.0.zip (see /tmp/foo/.tox/py36/log/py36-3.log) (exited with code 1)
|
pip._internal.exceptions.InstallationError
|
def run_install_command(self, packages, action, options=()):
def expand(val):
# expand an install command
if val == "{packages}":
for package in packages:
yield package
elif val == "{opts}":
for opt in options:
yield opt
else:
yield val
cmd = list(
chain.from_iterable(expand(val) for val in self.envconfig.install_command)
)
self.ensure_pip_os_environ_ok()
old_stdout = sys.stdout
sys.stdout = codecs.getwriter("utf8")(sys.stdout)
try:
self._pcall(
cmd,
cwd=self.envconfig.config.toxinidir,
action=action,
redirect=self.session.report.verbosity < 2,
)
finally:
sys.stdout = old_stdout
|
def run_install_command(self, packages, action, options=()):
argv = self.envconfig.install_command[:]
i = argv.index("{packages}")
argv[i : i + 1] = packages
if "{opts}" in argv:
i = argv.index("{opts}")
argv[i : i + 1] = list(options)
for x in (
"PIP_RESPECT_VIRTUALENV",
"PIP_REQUIRE_VIRTUALENV",
"__PYVENV_LAUNCHER__",
):
os.environ.pop(x, None)
if "PYTHONPATH" not in self.envconfig.passenv:
# If PYTHONPATH not explicitly asked for, remove it.
if "PYTHONPATH" in os.environ:
self.session.report.warning(
"Discarding $PYTHONPATH from environment, to override "
"specify PYTHONPATH in 'passenv' in your configuration."
)
os.environ.pop("PYTHONPATH")
old_stdout = sys.stdout
sys.stdout = codecs.getwriter("utf8")(sys.stdout)
try:
self._pcall(
argv,
cwd=self.envconfig.config.toxinidir,
action=action,
redirect=self.session.report.verbosity < 2,
)
finally:
sys.stdout = old_stdout
|
https://github.com/tox-dev/tox/issues/838
|
GLOB sdist-make: /tmp/foo/setup.py
py36 inst-nodeps: /tmp/foo/.tox/dist/foo-0.0.0.zip
ERROR: invocation failed (exit code 1), logfile: /tmp/foo/.tox/py36/log/py36-3.log
ERROR: actionid: py36
msg: installpkg
cmdargs: ['/tmp/foo/.tox/py36/bin/pip', 'install', '-U', '--no-deps', '/tmp/foo/.tox/dist/foo-0.0.0.zip']
Can not perform a '--user' install. User site-packages are not visible in this virtualenv.
Exception information:
Traceback (most recent call last):
File "/tmp/foo/.tox/py36/lib/python3.6/site-packages/pip/_internal/basecommand.py", line 228, in main
status = self.run(options, args)
File "/tmp/foo/.tox/py36/lib/python3.6/site-packages/pip/_internal/commands/install.py", line 218, in run
"Can not perform a '--user' install. User site-packages "
pip._internal.exceptions.InstallationError: Can not perform a '--user' install. User site-packages are not visible in this virtualenv.
py36 installed: foo==0.0.0
_____________________________________________________________________________________________ summary ______________________________________________________________________________________________
ERROR: py36: InvocationError for command /tmp/foo/.tox/py36/bin/pip install -U --no-deps /tmp/foo/.tox/dist/foo-0.0.0.zip (see /tmp/foo/.tox/py36/log/py36-3.log) (exited with code 1)
|
pip._internal.exceptions.InstallationError
|
def _pcall(
self,
args,
cwd,
venv=True,
is_test_command=False,
action=None,
redirect=True,
ignore_ret=False,
):
# construct environment variables
os.environ.pop("VIRTUALENV_PYTHON", None)
env = self._get_os_environ(is_test_command=is_test_command)
bin_dir = str(self.envconfig.envbindir)
env["PATH"] = os.pathsep.join([bin_dir, os.environ["PATH"]])
self.session.report.verbosity2("setting PATH={}".format(env["PATH"]))
# get command
args[0] = self.getcommandpath(args[0], venv, cwd)
if sys.platform != "win32" and "TOX_LIMITED_SHEBANG" in os.environ:
args = prepend_shebang_interpreter(args)
cwd.ensure(dir=1) # ensure the cwd exists
return action.popen(
args, cwd=cwd, env=env, redirect=redirect, ignore_ret=ignore_ret
)
|
def _pcall(
self,
args,
cwd,
venv=True,
testcommand=False,
action=None,
redirect=True,
ignore_ret=False,
):
os.environ.pop("VIRTUALENV_PYTHON", None)
cwd.ensure(dir=1)
args[0] = self.getcommandpath(args[0], venv, cwd)
if sys.platform != "win32" and "TOX_LIMITED_SHEBANG" in os.environ:
args = prepend_shebang_interpreter(args)
env = self._getenv(testcommand=testcommand)
bindir = str(self.envconfig.envbindir)
env["PATH"] = p = os.pathsep.join([bindir, os.environ["PATH"]])
self.session.report.verbosity2("setting PATH={}".format(p))
return action.popen(
args, cwd=cwd, env=env, redirect=redirect, ignore_ret=ignore_ret
)
|
https://github.com/tox-dev/tox/issues/838
|
GLOB sdist-make: /tmp/foo/setup.py
py36 inst-nodeps: /tmp/foo/.tox/dist/foo-0.0.0.zip
ERROR: invocation failed (exit code 1), logfile: /tmp/foo/.tox/py36/log/py36-3.log
ERROR: actionid: py36
msg: installpkg
cmdargs: ['/tmp/foo/.tox/py36/bin/pip', 'install', '-U', '--no-deps', '/tmp/foo/.tox/dist/foo-0.0.0.zip']
Can not perform a '--user' install. User site-packages are not visible in this virtualenv.
Exception information:
Traceback (most recent call last):
File "/tmp/foo/.tox/py36/lib/python3.6/site-packages/pip/_internal/basecommand.py", line 228, in main
status = self.run(options, args)
File "/tmp/foo/.tox/py36/lib/python3.6/site-packages/pip/_internal/commands/install.py", line 218, in run
"Can not perform a '--user' install. User site-packages "
pip._internal.exceptions.InstallationError: Can not perform a '--user' install. User site-packages are not visible in this virtualenv.
py36 installed: foo==0.0.0
_____________________________________________________________________________________________ summary ______________________________________________________________________________________________
ERROR: py36: InvocationError for command /tmp/foo/.tox/py36/bin/pip install -U --no-deps /tmp/foo/.tox/dist/foo-0.0.0.zip (see /tmp/foo/.tox/py36/log/py36-3.log) (exited with code 1)
|
pip._internal.exceptions.InstallationError
|
def prepend_shebang_interpreter(args):
# prepend interpreter directive (if any) to argument list
#
# When preparing virtual environments in a file container which has large
# length, the system might not be able to invoke shebang scripts which
# define interpreters beyond system limits (e.x. Linux as a limit of 128;
# BINPRM_BUF_SIZE). This method can be used to check if the executable is
# a script containing a shebang line. If so, extract the interpreter (and
# possible optional argument) and prepend the values to the provided
# argument list. tox will only attempt to read an interpreter directive of
# a maximum size of 2048 bytes to limit excessive reading and support UNIX
# systems which may support a longer interpret length.
try:
with open(args[0], "rb") as f:
if f.read(1) == b"#" and f.read(1) == b"!":
MAXINTERP = 2048
interp = f.readline(MAXINTERP).rstrip().decode("UTF-8")
interp_args = interp.split(None, 1)[:2]
return interp_args + args
except (UnicodeDecodeError, IOError):
pass
return args
|
def prepend_shebang_interpreter(args):
# prepend interpreter directive (if any) to argument list
#
# When preparing virtual environments in a file container which has large
# length, the system might not be able to invoke shebang scripts which
# define interpreters beyond system limits (e.x. Linux as a limit of 128;
# BINPRM_BUF_SIZE). This method can be used to check if the executable is
# a script containing a shebang line. If so, extract the interpreter (and
# possible optional argument) and prepend the values to the provided
# argument list. tox will only attempt to read an interpreter directive of
# a maximum size of 2048 bytes to limit excessive reading and support UNIX
# systems which may support a longer interpret length.
try:
with open(args[0], "rb") as f:
if f.read(1) == b"#" and f.read(1) == b"!":
MAXINTERP = 2048
interp = f.readline(MAXINTERP).rstrip()
interp_args = interp.split(None, 1)[:2]
return interp_args + args
except IOError:
pass
return args
|
https://github.com/tox-dev/tox/issues/931
|
(.venv) [vlotorev@cygnus-pc infra-ci-scripts]$ export TOX_LIMITED_SHEBANG=1
(.venv) [vlotorev@cygnus-pc infra-ci-scripts]$ tox
ERROR: invocation failed (errno 2), args: [b'/homefs/vlotorev/projects/infra-ci-scripts/.tox/py34/bin/python3.4', '/homefs/vlotorev/projects/infra-ci-scripts/.tox/py34/bin/pip', 'freeze'], cwd: /homefs/vlotorev/projects/infra-ci-scripts
Traceback (most recent call last):
File "/homefs/vlotorev/projects/infra-ci-scripts/.venv/bin/tox", line 11, in <module>
sys.exit(cmdline())
File "/homefs/vlotorev/projects/infra-ci-scripts/.venv/lib64/python3.4/site-packages/tox/session.py", line 39, in cmdline
main(args)
File "/homefs/vlotorev/projects/infra-ci-scripts/.venv/lib64/python3.4/site-packages/tox/session.py", line 45, in main
retcode = Session(config).runcommand()
File "/homefs/vlotorev/projects/infra-ci-scripts/.venv/lib64/python3.4/site-packages/tox/session.py", line 422, in runcommand
return self.subcommand_test()
File "/homefs/vlotorev/projects/infra-ci-scripts/.venv/lib64/python3.4/site-packages/tox/session.py", line 622, in subcommand_test
self.runenvreport(venv)
File "/homefs/vlotorev/projects/infra-ci-scripts/.venv/lib64/python3.4/site-packages/tox/session.py", line 633, in runenvreport
packages = self.hook.tox_runenvreport(venv=venv, action=action)
File "/homefs/vlotorev/projects/infra-ci-scripts/.venv/lib64/python3.4/site-packages/pluggy/hooks.py", line 258, in __call__
return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
File "/homefs/vlotorev/projects/infra-ci-scripts/.venv/lib64/python3.4/site-packages/pluggy/manager.py", line 67, in _hookexec
return self._inner_hookexec(hook, methods, kwargs)
File "/homefs/vlotorev/projects/infra-ci-scripts/.venv/lib64/python3.4/site-packages/pluggy/manager.py", line 61, in <lambda>
firstresult=hook.spec_opts.get('firstresult'),
File "/homefs/vlotorev/projects/infra-ci-scripts/.venv/lib64/python3.4/site-packages/pluggy/callers.py", line 201, in _multicall
return outcome.get_result()
File "/homefs/vlotorev/projects/infra-ci-scripts/.venv/lib64/python3.4/site-packages/pluggy/callers.py", line 76, in get_result
raise ex[1].with_traceback(ex[2])
File "/homefs/vlotorev/projects/infra-ci-scripts/.venv/lib64/python3.4/site-packages/pluggy/callers.py", line 180, in _multicall
res = hook_impl.function(*args)
File "/homefs/vlotorev/projects/infra-ci-scripts/.venv/lib64/python3.4/site-packages/tox/venv.py", line 499, in tox_runenvreport
output = venv._pcall(args, cwd=venv.envconfig.config.toxinidir, action=action)
File "/homefs/vlotorev/projects/infra-ci-scripts/.venv/lib64/python3.4/site-packages/tox/venv.py", line 427, in _pcall
return action.popen(args, cwd=cwd, env=env, redirect=redirect, ignore_ret=ignore_ret)
File "/homefs/vlotorev/projects/infra-ci-scripts/.venv/lib64/python3.4/site-packages/tox/session.py", line 153, in popen
popen = self._popen(args, cwd, env=env, stdout=stdout, stderr=subprocess.STDOUT)
File "/homefs/vlotorev/projects/infra-ci-scripts/.venv/lib64/python3.4/site-packages/tox/session.py", line 248, in _popen
env=env,
File "/usr/lib64/python3.4/subprocess.py", line 856, in __init__
restore_signals, start_new_session)
File "/usr/lib64/python3.4/subprocess.py", line 1460, in _execute_child
raise child_exception_type(errno_num, err_msg)
FileNotFoundError: [Errno 2] No such file or directory: "b'/homefs/vlotorev/projects/infra-ci-scripts/.tox/py34/bin/python3.4'"
|
FileNotFoundError
|
def popen(
self, args, cwd=None, env=None, redirect=True, returnout=False, ignore_ret=False
):
stdout = outpath = None
resultjson = self.session.config.option.resultjson
if resultjson or redirect:
fout = self._initlogpath(self.id)
fout.write("actionid: %s\nmsg: %s\ncmdargs: %r\n\n" % (self.id, self.msg, args))
fout.flush()
outpath = py.path.local(fout.name)
fin = outpath.open("rb")
fin.read() # read the header, so it won't be written to stdout
stdout = fout
elif returnout:
stdout = subprocess.PIPE
if cwd is None:
# XXX cwd = self.session.config.cwd
cwd = py.path.local()
try:
popen = self._popen(args, cwd, env=env, stdout=stdout, stderr=subprocess.STDOUT)
except OSError as e:
self.report.error(
"invocation failed (errno %d), args: %s, cwd: %s" % (e.errno, args, cwd)
)
raise
popen.outpath = outpath
popen.args = [str(x) for x in args]
popen.cwd = cwd
popen.action = self
self._popenlist.append(popen)
try:
self.report.logpopen(popen, env=env)
try:
if resultjson and not redirect:
if popen.stderr is not None:
# prevent deadlock
raise ValueError("stderr must not be piped here")
# we read binary from the process and must write using a
# binary stream
buf = getattr(sys.stdout, "buffer", sys.stdout)
out = None
last_time = time.time()
while 1:
# we have to read one byte at a time, otherwise there
# might be no output for a long time with slow tests
data = fin.read(1)
if data:
buf.write(data)
if b"\n" in data or (time.time() - last_time) > 1:
# we flush on newlines or after 1 second to
# provide quick enough feedback to the user
# when printing a dot per test
buf.flush()
last_time = time.time()
elif popen.poll() is not None:
if popen.stdout is not None:
popen.stdout.close()
break
else:
time.sleep(0.1)
# the seek updates internal read buffers
fin.seek(0, 1)
fin.close()
else:
out, err = popen.communicate()
except KeyboardInterrupt:
self.report.keyboard_interrupt()
popen.wait()
raise
ret = popen.wait()
finally:
self._popenlist.remove(popen)
if ret and not ignore_ret:
invoked = " ".join(map(str, popen.args))
if outpath:
self.report.error(
"invocation failed (exit code %d), logfile: %s" % (ret, outpath)
)
out = outpath.read()
self.report.error(out)
if hasattr(self, "commandlog"):
self.commandlog.add_command(popen.args, out, ret)
raise tox.exception.InvocationError("%s (see %s)" % (invoked, outpath), ret)
else:
raise tox.exception.InvocationError("%r" % (invoked,), ret)
if not out and outpath:
out = outpath.read()
if hasattr(self, "commandlog"):
self.commandlog.add_command(popen.args, out, ret)
return out
|
def popen(
self, args, cwd=None, env=None, redirect=True, returnout=False, ignore_ret=False
):
stdout = outpath = None
resultjson = self.session.config.option.resultjson
if resultjson or redirect:
fout = self._initlogpath(self.id)
fout.write("actionid: %s\nmsg: %s\ncmdargs: %r\n\n" % (self.id, self.msg, args))
fout.flush()
outpath = py.path.local(fout.name)
fin = outpath.open("rb")
fin.read() # read the header, so it won't be written to stdout
stdout = fout
elif returnout:
stdout = subprocess.PIPE
if cwd is None:
# XXX cwd = self.session.config.cwd
cwd = py.path.local()
try:
popen = self._popen(args, cwd, env=env, stdout=stdout, stderr=subprocess.STDOUT)
except OSError as e:
self.report.error(
"invocation failed (errno %d), args: %s, cwd: %s" % (e.errno, args, cwd)
)
raise
popen.outpath = outpath
popen.args = [str(x) for x in args]
popen.cwd = cwd
popen.action = self
self._popenlist.append(popen)
try:
self.report.logpopen(popen, env=env)
try:
if resultjson and not redirect:
assert popen.stderr is None # prevent deadlock
out = None
last_time = time.time()
while 1:
# we have to read one byte at a time, otherwise there
# might be no output for a long time with slow tests
data = fin.read(1)
if data:
sys.stdout.write(data)
if b"\n" in data or (time.time() - last_time) > 1:
# we flush on newlines or after 1 second to
# provide quick enough feedback to the user
# when printing a dot per test
sys.stdout.flush()
last_time = time.time()
elif popen.poll() is not None:
if popen.stdout is not None:
popen.stdout.close()
break
else:
time.sleep(0.1)
# the seek updates internal read buffers
fin.seek(0, 1)
fin.close()
else:
out, err = popen.communicate()
except KeyboardInterrupt:
self.report.keyboard_interrupt()
popen.wait()
raise
ret = popen.wait()
finally:
self._popenlist.remove(popen)
if ret and not ignore_ret:
invoked = " ".join(map(str, popen.args))
if outpath:
self.report.error(
"invocation failed (exit code %d), logfile: %s" % (ret, outpath)
)
out = outpath.read()
self.report.error(out)
if hasattr(self, "commandlog"):
self.commandlog.add_command(popen.args, out, ret)
raise tox.exception.InvocationError("%s (see %s)" % (invoked, outpath), ret)
else:
raise tox.exception.InvocationError("%r" % (invoked,), ret)
if not out and outpath:
out = outpath.read()
if hasattr(self, "commandlog"):
self.commandlog.add_command(popen.args, out, ret)
return out
|
https://github.com/tox-dev/tox/issues/426
|
Traceback (most recent call last):
File "/home/devpi/devpi/bin/devpi", line 11, in <module>
sys.exit(main())
File "/home/devpi/devpi/local/lib/python3.5/site-packages/devpi/main.py", line 30, in main
return method(hub, hub.args)
File "/home/devpi/devpi/local/lib/python3.5/site-packages/devpi/test.py", line 223, in main
ret = devindex.runtox(*args)
File "/home/devpi/devpi/local/lib/python3.5/site-packages/devpi/test.py", line 92, in runtox
ret = toxrunner(toxargs)
File "/home/devpi/devpi/local/lib/python3.5/site-packages/tox/session.py", line 39, in main
retcode = Session(config).runcommand()
File "/home/devpi/devpi/local/lib/python3.5/site-packages/tox/session.py", line 375, in runcommand
return self.subcommand_test()
File "/home/devpi/devpi/local/lib/python3.5/site-packages/tox/session.py", line 526, in subcommand_test
if self.setupenv(venv):
File "/home/devpi/devpi/local/lib/python3.5/site-packages/tox/session.py", line 434, in setupenv
status = venv.update(action=action)
File "/home/devpi/devpi/local/lib/python3.5/site-packages/tox/venv.py", line 142, in update
action.setactivity("create", self.envconfig.envdir)
File "/home/devpi/devpi/local/lib/python3.5/site-packages/tox/session.py", line 96, in setactivity
self.report.verbosity0("%s %s: %s" % (self.venvname, name, msg), bold=True)
File "/home/devpi/devpi/local/lib/python3.5/site-packages/tox/session.py", line 301, in verbosity0
self.logline("%s" % msg, **opts)
File "/home/devpi/devpi/local/lib/python3.5/site-packages/tox/session.py", line 297, in logline
self.tw.line("%s" % msg, **opts)
File "/home/devpi/devpi/local/lib/python3.5/site-packages/py/_io/terminalwriter.py", line 201, in line
self.write(s, **kw)
File "/home/devpi/devpi/local/lib/python3.5/site-packages/py/_io/terminalwriter.py", line 198, in write
write_out(self._file, markupmsg)
File "/home/devpi/devpi/local/lib/python3.5/site-packages/py/_io/terminalwriter.py", line 333, in write_out
fil.write(msg)
File "/home/devpi/devpi/lib/python3.5/codecs.py", line 377, in write
self.stream.write(data)
TypeError: write() argument must be str, not bytes
|
TypeError
|
def main():
version = sys.version_info[:2]
virtualenv_open = ["virtualenv>=1.11.2"]
virtualenv_capped = ["virtualenv>=1.11.2,<14"]
install_requires = ["py>=1.4.17", "pluggy>=0.3.0,<1.0", "six"]
extras_require = {}
if has_environment_marker_support():
extras_require[':python_version=="2.6"'] = ["argparse"]
extras_require[':python_version=="3.2"'] = virtualenv_capped
extras_require[':python_version!="3.2"'] = virtualenv_open
else:
if version < (2, 7):
install_requires += ["argparse"]
install_requires += virtualenv_capped if version == (3, 2) else virtualenv_open
setuptools.setup(
name="tox",
description="virtualenv-based automation of test activities",
long_description=get_long_description(),
url="https://tox.readthedocs.org/",
use_scm_version=True,
license="http://opensource.org/licenses/MIT",
platforms=["unix", "linux", "osx", "cygwin", "win32"],
author="holger krekel",
author_email="holger@merlinux.eu",
packages=["tox"],
entry_points={
"console_scripts": "tox=tox:cmdline\ntox-quickstart=tox._quickstart:main"
},
setup_requires=["setuptools_scm"],
install_requires=install_requires,
extras_require=extras_require,
classifiers=[
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Operating System :: POSIX",
"Operating System :: Microsoft :: Windows",
"Operating System :: MacOS :: MacOS X",
"Topic :: Software Development :: Testing",
"Topic :: Software Development :: Libraries",
"Topic :: Utilities",
]
+ [
("Programming Language :: Python :: %s" % x)
for x in "2 2.6 2.7 3 3.3 3.4 3.5 3.6".split()
],
)
|
def main():
version = sys.version_info[:2]
virtualenv_open = ["virtualenv>=1.11.2"]
virtualenv_capped = ["virtualenv>=1.11.2,<14"]
install_requires = ["py>=1.4.17", "pluggy>=0.3.0,<1.0", "six"]
extras_require = {}
if has_environment_marker_support():
extras_require[':python_version=="2.6"'] = ["argparse"]
extras_require[':python_version=="3.2"'] = virtualenv_capped
extras_require[':python_version!="3.2"'] = virtualenv_open
else:
if version < (2, 7):
install_requires += ["argparse"]
install_requires += virtualenv_capped if version == (3, 2) else virtualenv_open
setuptools.setup(
name="tox",
description="virtualenv-based automation of test activities",
long_description=get_long_description(),
url="https://tox.readthedocs.org/",
use_scm_version=True,
license="http://opensource.org/licenses/MIT",
platforms=["unix", "linux", "osx", "cygwin", "win32"],
author="holger krekel",
author_email="holger@merlinux.eu",
packages=["tox"],
entry_points={
"console_scripts": "tox=tox:cmdline\ntox-quickstart=tox._quickstart:main"
},
setup_requires=["setuptools_scm"],
# we use a public tox version to test, see tox.ini's testenv
# "deps" definition for the required dependencies
tests_require=["tox"],
cmdclass={"test": Tox},
install_requires=install_requires,
extras_require=extras_require,
classifiers=[
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Operating System :: POSIX",
"Operating System :: Microsoft :: Windows",
"Operating System :: MacOS :: MacOS X",
"Topic :: Software Development :: Testing",
"Topic :: Software Development :: Libraries",
"Topic :: Utilities",
]
+ [
("Programming Language :: Python :: %s" % x)
for x in "2 2.6 2.7 3 3.3 3.4 3.5 3.6".split()
],
)
|
https://github.com/tox-dev/tox/issues/651
|
running test
running egg_info
writing requirements to tox.egg-info/requires.txt
writing tox.egg-info/PKG-INFO
writing top-level names to tox.egg-info/top_level.txt
writing dependency_links to tox.egg-info/dependency_links.txt
writing entry points to tox.egg-info/entry_points.txt
reading manifest file 'tox.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching 'CHANGELOG'
writing manifest file 'tox.egg-info/SOURCES.txt'
running build_ext
using tox.ini: /usr/src/RPM/BUILD/python-module-tox-2.9.1/tox.ini
using tox-2.9.1 from /usr/src/RPM/BUILD/python-module-tox-2.9.1/tox/__init__.pyc
GLOB sdist-make: /usr/src/RPM/BUILD/python-module-tox-2.9.1/setup.py
/usr/src/RPM/BUILD/python-module-tox-2.9.1$ /usr/bin/python /usr/src/RPM/BUILD/python-module-tox-2.9.1/setup.py sdist --formats=zip --dist-dir /usr/src/RPM/BUILD/python-module-tox-2.9.1/.tox/dist >/usr/src/RPM/BUILD/python-module-tox-2.9.1/.tox/log/tox-0.log
py create: /usr/src/RPM/BUILD/python-module-tox-2.9.1/.tox/py
/usr/src/RPM/BUILD/python-module-tox-2.9.1/.tox$ /usr/bin/python -m virtualenv --python /usr/bin/python py >/usr/src/RPM/BUILD/python-module-tox-2.9.1/.tox/py/log/py-0.log
py installdeps: pytest >= 3.0.0, pytest-cov, pytest-timeout, pytest-xdist
/usr/src/RPM/BUILD/python-module-tox-2.9.1$ /usr/src/RPM/BUILD/python-module-tox-2.9.1/.tox/py/bin/pip install pytest >= 3.0.0 pytest-cov pytest-timeout pytest-xdist >/usr/src/RPM/BUILD/python-module-tox-2.9.1/.tox/py/log/py-1.log
py inst: /usr/src/RPM/BUILD/python-module-tox-2.9.1/.tox/dist/tox-2.9.1.zip
/usr/src/RPM/BUILD/python-module-tox-2.9.1$ /usr/src/RPM/BUILD/python-module-tox-2.9.1/.tox/py/bin/pip install /usr/src/RPM/BUILD/python-module-tox-2.9.1/.tox/dist/tox-2.9.1.zip >/usr/src/RPM/BUILD/python-module-tox-2.9.1/.tox/py/log/py-2.log
ERROR: invocation failed (exit code 1), logfile: /usr/src/RPM/BUILD/python-module-tox-2.9.1/.tox/py/log/py-2.log
ERROR: actionid: py
msg: installpkg
cmdargs: ['/usr/src/RPM/BUILD/python-module-tox-2.9.1/.tox/py/bin/pip', 'install', '/usr/src/RPM/BUILD/python-module-tox-2.9.1/.tox/dist/tox-2.9.1.zip']
Processing ./.tox/dist/tox-2.9.1.zip
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/src/tmp/pip-GO568q-build/setup.py", line 100, in <module>
main()
File "/usr/src/tmp/pip-GO568q-build/setup.py", line 68, in main
long_description=get_long_description(),
File "/usr/src/tmp/pip-GO568q-build/setup.py", line 45, in get_long_description
with io.open(os.path.join(here, 'CHANGELOG.rst'), encoding='utf-8') as g:
IOError: [Errno 2] No such file or directory: '/usr/src/tmp/pip-GO568q-build/CHANGELOG.rst'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /usr/src/tmp/pip-GO568q-build/
|
IOError
|
def getdict(self, name, default=None, sep="\n", replace=True):
value = self.getstring(name, None, replace=replace)
return self._getdict(value, default=default, sep=sep, replace=replace)
|
def getdict(self, name, default=None, sep="\n", replace=True):
value = self.getstring(name, None, replace=replace)
return self._getdict(value, default=default, sep=sep)
|
https://github.com/tox-dev/tox/issues/595
|
2017-09-01 18:22:20.661 | ++ lib/tempest:install_tempest:612 : pushd /opt/stack/new/tempest
2017-09-01 18:22:20.661 | ~/tempest ~/devstack
2017-09-01 18:22:20.662 | ++ lib/tempest:install_tempest:613 : tox -r --notest -efull
2017-09-01 18:22:21.720 | Traceback (most recent call last):
2017-09-01 18:22:21.720 | File "/usr/local/bin/tox", line 11, in <module>
2017-09-01 18:22:21.720 | sys.exit(cmdline())
2017-09-01 18:22:21.720 | File "/usr/local/lib/python2.7/dist-packages/tox/session.py", line 38, in main
2017-09-01 18:22:21.720 | config = prepare(args)
2017-09-01 18:22:21.720 | File "/usr/local/lib/python2.7/dist-packages/tox/session.py", line 26, in prepare
2017-09-01 18:22:21.720 | config = parseconfig(args)
2017-09-01 18:22:21.720 | File "/usr/local/lib/python2.7/dist-packages/tox/config.py", line 242, in parseconfig
2017-09-01 18:22:21.720 | parseini(config, inipath)
2017-09-01 18:22:21.720 | File "/usr/local/lib/python2.7/dist-packages/tox/config.py", line 796, in __init__
2017-09-01 18:22:21.721 | replace=name in config.envlist)
2017-09-01 18:22:21.721 | File "/usr/local/lib/python2.7/dist-packages/tox/config.py", line 827, in make_envconfig
2017-09-01 18:22:21.721 | res = meth(env_attr.name, env_attr.default, replace=replace)
2017-09-01 18:22:21.721 | File "/usr/local/lib/python2.7/dist-packages/tox/config.py", line 964, in getdict_setenv
2017-09-01 18:22:21.721 | definitions = self._getdict(value, default=default, sep=sep)
2017-09-01 18:22:21.721 | File "/usr/local/lib/python2.7/dist-packages/tox/config.py", line 975, in _getdict
2017-09-01 18:22:21.721 | name, rest = line.split('=', 1)
2017-09-01 18:22:21.721 | ValueError: need more than 1 value to unpack
2017-09-01 18:22:21.733 | + lib/tempest:install_tempest:1 : exit_trap
|
ValueError
|
def getdict_setenv(self, name, default=None, sep="\n", replace=True):
value = self.getstring(name, None, replace=replace, crossonly=True)
definitions = self._getdict(value, default=default, sep=sep, replace=replace)
self._setenv = SetenvDict(definitions, reader=self)
return self._setenv
|
def getdict_setenv(self, name, default=None, sep="\n", replace=True):
value = self.getstring(name, None, replace=replace, crossonly=True)
definitions = self._getdict(value, default=default, sep=sep)
self._setenv = SetenvDict(definitions, reader=self)
return self._setenv
|
https://github.com/tox-dev/tox/issues/595
|
2017-09-01 18:22:20.661 | ++ lib/tempest:install_tempest:612 : pushd /opt/stack/new/tempest
2017-09-01 18:22:20.661 | ~/tempest ~/devstack
2017-09-01 18:22:20.662 | ++ lib/tempest:install_tempest:613 : tox -r --notest -efull
2017-09-01 18:22:21.720 | Traceback (most recent call last):
2017-09-01 18:22:21.720 | File "/usr/local/bin/tox", line 11, in <module>
2017-09-01 18:22:21.720 | sys.exit(cmdline())
2017-09-01 18:22:21.720 | File "/usr/local/lib/python2.7/dist-packages/tox/session.py", line 38, in main
2017-09-01 18:22:21.720 | config = prepare(args)
2017-09-01 18:22:21.720 | File "/usr/local/lib/python2.7/dist-packages/tox/session.py", line 26, in prepare
2017-09-01 18:22:21.720 | config = parseconfig(args)
2017-09-01 18:22:21.720 | File "/usr/local/lib/python2.7/dist-packages/tox/config.py", line 242, in parseconfig
2017-09-01 18:22:21.720 | parseini(config, inipath)
2017-09-01 18:22:21.720 | File "/usr/local/lib/python2.7/dist-packages/tox/config.py", line 796, in __init__
2017-09-01 18:22:21.721 | replace=name in config.envlist)
2017-09-01 18:22:21.721 | File "/usr/local/lib/python2.7/dist-packages/tox/config.py", line 827, in make_envconfig
2017-09-01 18:22:21.721 | res = meth(env_attr.name, env_attr.default, replace=replace)
2017-09-01 18:22:21.721 | File "/usr/local/lib/python2.7/dist-packages/tox/config.py", line 964, in getdict_setenv
2017-09-01 18:22:21.721 | definitions = self._getdict(value, default=default, sep=sep)
2017-09-01 18:22:21.721 | File "/usr/local/lib/python2.7/dist-packages/tox/config.py", line 975, in _getdict
2017-09-01 18:22:21.721 | name, rest = line.split('=', 1)
2017-09-01 18:22:21.721 | ValueError: need more than 1 value to unpack
2017-09-01 18:22:21.733 | + lib/tempest:install_tempest:1 : exit_trap
|
ValueError
|
def _getdict(self, value, default, sep, replace=True):
if value is None or not replace:
return default or {}
d = {}
for line in value.split(sep):
if line.strip():
name, rest = line.split("=", 1)
d[name.strip()] = rest.strip()
return d
|
def _getdict(self, value, default, sep):
if value is None:
return default or {}
d = {}
for line in value.split(sep):
if line.strip():
name, rest = line.split("=", 1)
d[name.strip()] = rest.strip()
return d
|
https://github.com/tox-dev/tox/issues/595
|
2017-09-01 18:22:20.661 | ++ lib/tempest:install_tempest:612 : pushd /opt/stack/new/tempest
2017-09-01 18:22:20.661 | ~/tempest ~/devstack
2017-09-01 18:22:20.662 | ++ lib/tempest:install_tempest:613 : tox -r --notest -efull
2017-09-01 18:22:21.720 | Traceback (most recent call last):
2017-09-01 18:22:21.720 | File "/usr/local/bin/tox", line 11, in <module>
2017-09-01 18:22:21.720 | sys.exit(cmdline())
2017-09-01 18:22:21.720 | File "/usr/local/lib/python2.7/dist-packages/tox/session.py", line 38, in main
2017-09-01 18:22:21.720 | config = prepare(args)
2017-09-01 18:22:21.720 | File "/usr/local/lib/python2.7/dist-packages/tox/session.py", line 26, in prepare
2017-09-01 18:22:21.720 | config = parseconfig(args)
2017-09-01 18:22:21.720 | File "/usr/local/lib/python2.7/dist-packages/tox/config.py", line 242, in parseconfig
2017-09-01 18:22:21.720 | parseini(config, inipath)
2017-09-01 18:22:21.720 | File "/usr/local/lib/python2.7/dist-packages/tox/config.py", line 796, in __init__
2017-09-01 18:22:21.721 | replace=name in config.envlist)
2017-09-01 18:22:21.721 | File "/usr/local/lib/python2.7/dist-packages/tox/config.py", line 827, in make_envconfig
2017-09-01 18:22:21.721 | res = meth(env_attr.name, env_attr.default, replace=replace)
2017-09-01 18:22:21.721 | File "/usr/local/lib/python2.7/dist-packages/tox/config.py", line 964, in getdict_setenv
2017-09-01 18:22:21.721 | definitions = self._getdict(value, default=default, sep=sep)
2017-09-01 18:22:21.721 | File "/usr/local/lib/python2.7/dist-packages/tox/config.py", line 975, in _getdict
2017-09-01 18:22:21.721 | name, rest = line.split('=', 1)
2017-09-01 18:22:21.721 | ValueError: need more than 1 value to unpack
2017-09-01 18:22:21.733 | + lib/tempest:install_tempest:1 : exit_trap
|
ValueError
|
def getbool(self, name, default=None, replace=True):
s = self.getstring(name, default, replace=replace)
if not s or not replace:
s = default
if s is None:
raise KeyError("no config value [%s] %s found" % (self.section_name, name))
if not isinstance(s, bool):
if s.lower() == "true":
s = True
elif s.lower() == "false":
s = False
else:
raise tox.exception.ConfigError(
"boolean value %r needs to be 'True' or 'False'"
)
return s
|
def getbool(self, name, default=None, replace=True):
s = self.getstring(name, default, replace=replace)
if not s:
s = default
if s is None:
raise KeyError("no config value [%s] %s found" % (self.section_name, name))
if not isinstance(s, bool):
if s.lower() == "true":
s = True
elif s.lower() == "false":
s = False
else:
raise tox.exception.ConfigError(
"boolean value %r needs to be 'True' or 'False'"
)
return s
|
https://github.com/tox-dev/tox/issues/595
|
2017-09-01 18:22:20.661 | ++ lib/tempest:install_tempest:612 : pushd /opt/stack/new/tempest
2017-09-01 18:22:20.661 | ~/tempest ~/devstack
2017-09-01 18:22:20.662 | ++ lib/tempest:install_tempest:613 : tox -r --notest -efull
2017-09-01 18:22:21.720 | Traceback (most recent call last):
2017-09-01 18:22:21.720 | File "/usr/local/bin/tox", line 11, in <module>
2017-09-01 18:22:21.720 | sys.exit(cmdline())
2017-09-01 18:22:21.720 | File "/usr/local/lib/python2.7/dist-packages/tox/session.py", line 38, in main
2017-09-01 18:22:21.720 | config = prepare(args)
2017-09-01 18:22:21.720 | File "/usr/local/lib/python2.7/dist-packages/tox/session.py", line 26, in prepare
2017-09-01 18:22:21.720 | config = parseconfig(args)
2017-09-01 18:22:21.720 | File "/usr/local/lib/python2.7/dist-packages/tox/config.py", line 242, in parseconfig
2017-09-01 18:22:21.720 | parseini(config, inipath)
2017-09-01 18:22:21.720 | File "/usr/local/lib/python2.7/dist-packages/tox/config.py", line 796, in __init__
2017-09-01 18:22:21.721 | replace=name in config.envlist)
2017-09-01 18:22:21.721 | File "/usr/local/lib/python2.7/dist-packages/tox/config.py", line 827, in make_envconfig
2017-09-01 18:22:21.721 | res = meth(env_attr.name, env_attr.default, replace=replace)
2017-09-01 18:22:21.721 | File "/usr/local/lib/python2.7/dist-packages/tox/config.py", line 964, in getdict_setenv
2017-09-01 18:22:21.721 | definitions = self._getdict(value, default=default, sep=sep)
2017-09-01 18:22:21.721 | File "/usr/local/lib/python2.7/dist-packages/tox/config.py", line 975, in _getdict
2017-09-01 18:22:21.721 | name, rest = line.split('=', 1)
2017-09-01 18:22:21.721 | ValueError: need more than 1 value to unpack
2017-09-01 18:22:21.733 | + lib/tempest:install_tempest:1 : exit_trap
|
ValueError
|
def __init__(self, envname, config, factors, reader):
#: test environment name
self.envname = envname
#: global tox config object
self.config = config
#: set of factors
self.factors = factors
self._reader = reader
self.missing_subs = []
"""Holds substitutions that could not be resolved.
Pre 2.8.1 missing substitutions crashed with a ConfigError although this would not be a
problem if the env is not part of the current testrun. So we need to remember this and
check later when the testenv is actually run and crash only then.
"""
|
def __init__(self, envname, config, factors, reader):
#: test environment name
self.envname = envname
#: global tox config object
self.config = config
#: set of factors
self.factors = factors
self._reader = reader
|
https://github.com/tox-dev/tox/issues/595
|
2017-09-01 18:22:20.661 | ++ lib/tempest:install_tempest:612 : pushd /opt/stack/new/tempest
2017-09-01 18:22:20.661 | ~/tempest ~/devstack
2017-09-01 18:22:20.662 | ++ lib/tempest:install_tempest:613 : tox -r --notest -efull
2017-09-01 18:22:21.720 | Traceback (most recent call last):
2017-09-01 18:22:21.720 | File "/usr/local/bin/tox", line 11, in <module>
2017-09-01 18:22:21.720 | sys.exit(cmdline())
2017-09-01 18:22:21.720 | File "/usr/local/lib/python2.7/dist-packages/tox/session.py", line 38, in main
2017-09-01 18:22:21.720 | config = prepare(args)
2017-09-01 18:22:21.720 | File "/usr/local/lib/python2.7/dist-packages/tox/session.py", line 26, in prepare
2017-09-01 18:22:21.720 | config = parseconfig(args)
2017-09-01 18:22:21.720 | File "/usr/local/lib/python2.7/dist-packages/tox/config.py", line 242, in parseconfig
2017-09-01 18:22:21.720 | parseini(config, inipath)
2017-09-01 18:22:21.720 | File "/usr/local/lib/python2.7/dist-packages/tox/config.py", line 796, in __init__
2017-09-01 18:22:21.721 | replace=name in config.envlist)
2017-09-01 18:22:21.721 | File "/usr/local/lib/python2.7/dist-packages/tox/config.py", line 827, in make_envconfig
2017-09-01 18:22:21.721 | res = meth(env_attr.name, env_attr.default, replace=replace)
2017-09-01 18:22:21.721 | File "/usr/local/lib/python2.7/dist-packages/tox/config.py", line 964, in getdict_setenv
2017-09-01 18:22:21.721 | definitions = self._getdict(value, default=default, sep=sep)
2017-09-01 18:22:21.721 | File "/usr/local/lib/python2.7/dist-packages/tox/config.py", line 975, in _getdict
2017-09-01 18:22:21.721 | name, rest = line.split('=', 1)
2017-09-01 18:22:21.721 | ValueError: need more than 1 value to unpack
2017-09-01 18:22:21.733 | + lib/tempest:install_tempest:1 : exit_trap
|
ValueError
|
def __init__(self, config, inipath):
config.toxinipath = inipath
config.toxinidir = config.toxinipath.dirpath()
self._cfg = py.iniconfig.IniConfig(config.toxinipath)
config._cfg = self._cfg
self.config = config
if inipath.basename == "setup.cfg":
prefix = "tox"
else:
prefix = None
ctxname = getcontextname()
if ctxname == "jenkins":
reader = SectionReader(
"tox:jenkins", self._cfg, prefix=prefix, fallbacksections=["tox"]
)
distshare_default = "{toxworkdir}/distshare"
elif not ctxname:
reader = SectionReader("tox", self._cfg, prefix=prefix)
distshare_default = "{homedir}/.tox/distshare"
else:
raise ValueError("invalid context")
if config.option.hashseed is None:
hashseed = make_hashseed()
elif config.option.hashseed == "noset":
hashseed = None
else:
hashseed = config.option.hashseed
config.hashseed = hashseed
reader.addsubstitutions(toxinidir=config.toxinidir, homedir=config.homedir)
# As older versions of tox may have bugs or incompatabilities that
# prevent parsing of tox.ini this must be the first thing checked.
config.minversion = reader.getstring("minversion", None)
if config.minversion:
minversion = NormalizedVersion(self.config.minversion)
toxversion = NormalizedVersion(tox.__version__)
if toxversion < minversion:
raise tox.exception.MinVersionError(
"tox version is %s, required is at least %s" % (toxversion, minversion)
)
if config.option.workdir is None:
config.toxworkdir = reader.getpath("toxworkdir", "{toxinidir}/.tox")
else:
config.toxworkdir = config.toxinidir.join(config.option.workdir, abs=True)
if not config.option.skip_missing_interpreters:
config.option.skip_missing_interpreters = reader.getbool(
"skip_missing_interpreters", False
)
# determine indexserver dictionary
config.indexserver = {"default": IndexServerConfig("default")}
prefix = "indexserver"
for line in reader.getlist(prefix):
name, url = map(lambda x: x.strip(), line.split("=", 1))
config.indexserver[name] = IndexServerConfig(name, url)
override = False
if config.option.indexurl:
for urldef in config.option.indexurl:
m = re.match(r"\W*(\w+)=(\S+)", urldef)
if m is None:
url = urldef
name = "default"
else:
name, url = m.groups()
if not url:
url = None
if name != "ALL":
config.indexserver[name].url = url
else:
override = url
# let ALL override all existing entries
if override:
for name in config.indexserver:
config.indexserver[name] = IndexServerConfig(name, override)
reader.addsubstitutions(toxworkdir=config.toxworkdir)
config.distdir = reader.getpath("distdir", "{toxworkdir}/dist")
reader.addsubstitutions(distdir=config.distdir)
config.distshare = reader.getpath("distshare", distshare_default)
reader.addsubstitutions(distshare=config.distshare)
config.sdistsrc = reader.getpath("sdistsrc", None)
config.setupdir = reader.getpath("setupdir", "{toxinidir}")
config.logdir = config.toxworkdir.join("log")
config.envlist, all_envs = self._getenvdata(reader)
# factors used in config or predefined
known_factors = self._list_section_factors("testenv")
known_factors.update(default_factors)
known_factors.add("python")
# factors stated in config envlist
stated_envlist = reader.getstring("envlist", replace=False)
if stated_envlist:
for env in _split_env(stated_envlist):
known_factors.update(env.split("-"))
# configure testenvs
for name in all_envs:
section = testenvprefix + name
factors = set(name.split("-"))
if section in self._cfg or factors <= known_factors:
config.envconfigs[name] = self.make_envconfig(
name, section, reader._subs, config
)
all_develop = all(
name in config.envconfigs and config.envconfigs[name].usedevelop
for name in config.envlist
)
config.skipsdist = reader.getbool("skipsdist", all_develop)
|
def __init__(self, config, inipath):
config.toxinipath = inipath
config.toxinidir = config.toxinipath.dirpath()
self._cfg = py.iniconfig.IniConfig(config.toxinipath)
config._cfg = self._cfg
self.config = config
if inipath.basename == "setup.cfg":
prefix = "tox"
else:
prefix = None
ctxname = getcontextname()
if ctxname == "jenkins":
reader = SectionReader(
"tox:jenkins", self._cfg, prefix=prefix, fallbacksections=["tox"]
)
distshare_default = "{toxworkdir}/distshare"
elif not ctxname:
reader = SectionReader("tox", self._cfg, prefix=prefix)
distshare_default = "{homedir}/.tox/distshare"
else:
raise ValueError("invalid context")
if config.option.hashseed is None:
hashseed = make_hashseed()
elif config.option.hashseed == "noset":
hashseed = None
else:
hashseed = config.option.hashseed
config.hashseed = hashseed
reader.addsubstitutions(toxinidir=config.toxinidir, homedir=config.homedir)
# As older versions of tox may have bugs or incompatabilities that
# prevent parsing of tox.ini this must be the first thing checked.
config.minversion = reader.getstring("minversion", None)
if config.minversion:
minversion = NormalizedVersion(self.config.minversion)
toxversion = NormalizedVersion(tox.__version__)
if toxversion < minversion:
raise tox.exception.MinVersionError(
"tox version is %s, required is at least %s" % (toxversion, minversion)
)
if config.option.workdir is None:
config.toxworkdir = reader.getpath("toxworkdir", "{toxinidir}/.tox")
else:
config.toxworkdir = config.toxinidir.join(config.option.workdir, abs=True)
if not config.option.skip_missing_interpreters:
config.option.skip_missing_interpreters = reader.getbool(
"skip_missing_interpreters", False
)
# determine indexserver dictionary
config.indexserver = {"default": IndexServerConfig("default")}
prefix = "indexserver"
for line in reader.getlist(prefix):
name, url = map(lambda x: x.strip(), line.split("=", 1))
config.indexserver[name] = IndexServerConfig(name, url)
override = False
if config.option.indexurl:
for urldef in config.option.indexurl:
m = re.match(r"\W*(\w+)=(\S+)", urldef)
if m is None:
url = urldef
name = "default"
else:
name, url = m.groups()
if not url:
url = None
if name != "ALL":
config.indexserver[name].url = url
else:
override = url
# let ALL override all existing entries
if override:
for name in config.indexserver:
config.indexserver[name] = IndexServerConfig(name, override)
reader.addsubstitutions(toxworkdir=config.toxworkdir)
config.distdir = reader.getpath("distdir", "{toxworkdir}/dist")
reader.addsubstitutions(distdir=config.distdir)
config.distshare = reader.getpath("distshare", distshare_default)
reader.addsubstitutions(distshare=config.distshare)
config.sdistsrc = reader.getpath("sdistsrc", None)
config.setupdir = reader.getpath("setupdir", "{toxinidir}")
config.logdir = config.toxworkdir.join("log")
config.envlist, all_envs = self._getenvdata(reader)
# factors used in config or predefined
known_factors = self._list_section_factors("testenv")
known_factors.update(default_factors)
known_factors.add("python")
# factors stated in config envlist
stated_envlist = reader.getstring("envlist", replace=False)
if stated_envlist:
for env in _split_env(stated_envlist):
known_factors.update(env.split("-"))
# configure testenvs
for name in all_envs:
section = testenvprefix + name
factors = set(name.split("-"))
if section in self._cfg or factors <= known_factors:
config.envconfigs[name] = self.make_envconfig(
name, section, reader._subs, config, replace=name in config.envlist
)
all_develop = all(
name in config.envconfigs and config.envconfigs[name].usedevelop
for name in config.envlist
)
config.skipsdist = reader.getbool("skipsdist", all_develop)
|
https://github.com/tox-dev/tox/issues/595
|
2017-09-01 18:22:20.661 | ++ lib/tempest:install_tempest:612 : pushd /opt/stack/new/tempest
2017-09-01 18:22:20.661 | ~/tempest ~/devstack
2017-09-01 18:22:20.662 | ++ lib/tempest:install_tempest:613 : tox -r --notest -efull
2017-09-01 18:22:21.720 | Traceback (most recent call last):
2017-09-01 18:22:21.720 | File "/usr/local/bin/tox", line 11, in <module>
2017-09-01 18:22:21.720 | sys.exit(cmdline())
2017-09-01 18:22:21.720 | File "/usr/local/lib/python2.7/dist-packages/tox/session.py", line 38, in main
2017-09-01 18:22:21.720 | config = prepare(args)
2017-09-01 18:22:21.720 | File "/usr/local/lib/python2.7/dist-packages/tox/session.py", line 26, in prepare
2017-09-01 18:22:21.720 | config = parseconfig(args)
2017-09-01 18:22:21.720 | File "/usr/local/lib/python2.7/dist-packages/tox/config.py", line 242, in parseconfig
2017-09-01 18:22:21.720 | parseini(config, inipath)
2017-09-01 18:22:21.720 | File "/usr/local/lib/python2.7/dist-packages/tox/config.py", line 796, in __init__
2017-09-01 18:22:21.721 | replace=name in config.envlist)
2017-09-01 18:22:21.721 | File "/usr/local/lib/python2.7/dist-packages/tox/config.py", line 827, in make_envconfig
2017-09-01 18:22:21.721 | res = meth(env_attr.name, env_attr.default, replace=replace)
2017-09-01 18:22:21.721 | File "/usr/local/lib/python2.7/dist-packages/tox/config.py", line 964, in getdict_setenv
2017-09-01 18:22:21.721 | definitions = self._getdict(value, default=default, sep=sep)
2017-09-01 18:22:21.721 | File "/usr/local/lib/python2.7/dist-packages/tox/config.py", line 975, in _getdict
2017-09-01 18:22:21.721 | name, rest = line.split('=', 1)
2017-09-01 18:22:21.721 | ValueError: need more than 1 value to unpack
2017-09-01 18:22:21.733 | + lib/tempest:install_tempest:1 : exit_trap
|
ValueError
|
def make_envconfig(self, name, section, subs, config, replace=True):
factors = set(name.split("-"))
reader = SectionReader(
section, self._cfg, fallbacksections=["testenv"], factors=factors
)
tc = TestenvConfig(name, config, factors, reader)
reader.addsubstitutions(
envname=name,
envbindir=tc.get_envbindir,
envsitepackagesdir=tc.get_envsitepackagesdir,
envpython=tc.get_envpython,
**subs,
)
for env_attr in config._testenv_attr:
atype = env_attr.type
try:
if atype in (
"bool",
"path",
"string",
"dict",
"dict_setenv",
"argv",
"argvlist",
):
meth = getattr(reader, "get" + atype)
res = meth(env_attr.name, env_attr.default, replace=replace)
elif atype == "space-separated-list":
res = reader.getlist(env_attr.name, sep=" ")
elif atype == "line-list":
res = reader.getlist(env_attr.name, sep="\n")
else:
raise ValueError("unknown type %r" % (atype,))
if env_attr.postprocess:
res = env_attr.postprocess(testenv_config=tc, value=res)
except tox.exception.MissingSubstitution as e:
tc.missing_subs.append(e.name)
res = e.FLAG
setattr(tc, env_attr.name, res)
if atype in ("path", "string"):
reader.addsubstitutions(**{env_attr.name: res})
return tc
|
def make_envconfig(self, name, section, subs, config, replace=True):
factors = set(name.split("-"))
reader = SectionReader(
section, self._cfg, fallbacksections=["testenv"], factors=factors
)
vc = TestenvConfig(config=config, envname=name, factors=factors, reader=reader)
reader.addsubstitutions(**subs)
reader.addsubstitutions(envname=name)
reader.addsubstitutions(
envbindir=vc.get_envbindir,
envsitepackagesdir=vc.get_envsitepackagesdir,
envpython=vc.get_envpython,
)
for env_attr in config._testenv_attr:
atype = env_attr.type
if atype in (
"bool",
"path",
"string",
"dict",
"dict_setenv",
"argv",
"argvlist",
):
meth = getattr(reader, "get" + atype)
res = meth(env_attr.name, env_attr.default, replace=replace)
elif atype == "space-separated-list":
res = reader.getlist(env_attr.name, sep=" ")
elif atype == "line-list":
res = reader.getlist(env_attr.name, sep="\n")
else:
raise ValueError("unknown type %r" % (atype,))
if env_attr.postprocess:
res = env_attr.postprocess(testenv_config=vc, value=res)
setattr(vc, env_attr.name, res)
if atype in ("path", "string"):
reader.addsubstitutions(**{env_attr.name: res})
return vc
|
https://github.com/tox-dev/tox/issues/595
|
2017-09-01 18:22:20.661 | ++ lib/tempest:install_tempest:612 : pushd /opt/stack/new/tempest
2017-09-01 18:22:20.661 | ~/tempest ~/devstack
2017-09-01 18:22:20.662 | ++ lib/tempest:install_tempest:613 : tox -r --notest -efull
2017-09-01 18:22:21.720 | Traceback (most recent call last):
2017-09-01 18:22:21.720 | File "/usr/local/bin/tox", line 11, in <module>
2017-09-01 18:22:21.720 | sys.exit(cmdline())
2017-09-01 18:22:21.720 | File "/usr/local/lib/python2.7/dist-packages/tox/session.py", line 38, in main
2017-09-01 18:22:21.720 | config = prepare(args)
2017-09-01 18:22:21.720 | File "/usr/local/lib/python2.7/dist-packages/tox/session.py", line 26, in prepare
2017-09-01 18:22:21.720 | config = parseconfig(args)
2017-09-01 18:22:21.720 | File "/usr/local/lib/python2.7/dist-packages/tox/config.py", line 242, in parseconfig
2017-09-01 18:22:21.720 | parseini(config, inipath)
2017-09-01 18:22:21.720 | File "/usr/local/lib/python2.7/dist-packages/tox/config.py", line 796, in __init__
2017-09-01 18:22:21.721 | replace=name in config.envlist)
2017-09-01 18:22:21.721 | File "/usr/local/lib/python2.7/dist-packages/tox/config.py", line 827, in make_envconfig
2017-09-01 18:22:21.721 | res = meth(env_attr.name, env_attr.default, replace=replace)
2017-09-01 18:22:21.721 | File "/usr/local/lib/python2.7/dist-packages/tox/config.py", line 964, in getdict_setenv
2017-09-01 18:22:21.721 | definitions = self._getdict(value, default=default, sep=sep)
2017-09-01 18:22:21.721 | File "/usr/local/lib/python2.7/dist-packages/tox/config.py", line 975, in _getdict
2017-09-01 18:22:21.721 | name, rest = line.split('=', 1)
2017-09-01 18:22:21.721 | ValueError: need more than 1 value to unpack
2017-09-01 18:22:21.733 | + lib/tempest:install_tempest:1 : exit_trap
|
ValueError
|
def _replace(self, value, name=None, section_name=None, crossonly=False):
if "{" not in value:
return value
section_name = section_name if section_name else self.section_name
self._subststack.append((section_name, name))
try:
replaced = Replacer(self, crossonly=crossonly).do_replace(value)
assert self._subststack.pop() == (section_name, name)
except tox.exception.MissingSubstitution:
if not section_name.startswith(testenvprefix):
raise tox.exception.ConfigError(
"substitution env:%r: unknown or recursive definition in "
"section %r." % (value, section_name)
)
raise
return replaced
|
def _replace(self, value, name=None, section_name=None, crossonly=False):
if "{" not in value:
return value
section_name = section_name if section_name else self.section_name
self._subststack.append((section_name, name))
try:
return Replacer(self, crossonly=crossonly).do_replace(value)
finally:
assert self._subststack.pop() == (section_name, name)
|
https://github.com/tox-dev/tox/issues/595
|
2017-09-01 18:22:20.661 | ++ lib/tempest:install_tempest:612 : pushd /opt/stack/new/tempest
2017-09-01 18:22:20.661 | ~/tempest ~/devstack
2017-09-01 18:22:20.662 | ++ lib/tempest:install_tempest:613 : tox -r --notest -efull
2017-09-01 18:22:21.720 | Traceback (most recent call last):
2017-09-01 18:22:21.720 | File "/usr/local/bin/tox", line 11, in <module>
2017-09-01 18:22:21.720 | sys.exit(cmdline())
2017-09-01 18:22:21.720 | File "/usr/local/lib/python2.7/dist-packages/tox/session.py", line 38, in main
2017-09-01 18:22:21.720 | config = prepare(args)
2017-09-01 18:22:21.720 | File "/usr/local/lib/python2.7/dist-packages/tox/session.py", line 26, in prepare
2017-09-01 18:22:21.720 | config = parseconfig(args)
2017-09-01 18:22:21.720 | File "/usr/local/lib/python2.7/dist-packages/tox/config.py", line 242, in parseconfig
2017-09-01 18:22:21.720 | parseini(config, inipath)
2017-09-01 18:22:21.720 | File "/usr/local/lib/python2.7/dist-packages/tox/config.py", line 796, in __init__
2017-09-01 18:22:21.721 | replace=name in config.envlist)
2017-09-01 18:22:21.721 | File "/usr/local/lib/python2.7/dist-packages/tox/config.py", line 827, in make_envconfig
2017-09-01 18:22:21.721 | res = meth(env_attr.name, env_attr.default, replace=replace)
2017-09-01 18:22:21.721 | File "/usr/local/lib/python2.7/dist-packages/tox/config.py", line 964, in getdict_setenv
2017-09-01 18:22:21.721 | definitions = self._getdict(value, default=default, sep=sep)
2017-09-01 18:22:21.721 | File "/usr/local/lib/python2.7/dist-packages/tox/config.py", line 975, in _getdict
2017-09-01 18:22:21.721 | name, rest = line.split('=', 1)
2017-09-01 18:22:21.721 | ValueError: need more than 1 value to unpack
2017-09-01 18:22:21.733 | + lib/tempest:install_tempest:1 : exit_trap
|
ValueError
|
def _replace_env(self, match):
envkey = match.group("substitution_value")
if not envkey:
raise tox.exception.ConfigError("env: requires an environment variable name")
default = match.group("default_value")
envvalue = self.reader.get_environ_value(envkey)
if envvalue is not None:
return envvalue
if default is not None:
return default
raise tox.exception.MissingSubstitution(envkey)
|
def _replace_env(self, match):
envkey = match.group("substitution_value")
if not envkey:
raise tox.exception.ConfigError("env: requires an environment variable name")
default = match.group("default_value")
envvalue = self.reader.get_environ_value(envkey)
if envvalue is None:
if default is None:
raise tox.exception.ConfigError(
"substitution env:%r: unknown environment variable %r "
" or recursive definition." % (envkey, envkey)
)
return default
return envvalue
|
https://github.com/tox-dev/tox/issues/595
|
2017-09-01 18:22:20.661 | ++ lib/tempest:install_tempest:612 : pushd /opt/stack/new/tempest
2017-09-01 18:22:20.661 | ~/tempest ~/devstack
2017-09-01 18:22:20.662 | ++ lib/tempest:install_tempest:613 : tox -r --notest -efull
2017-09-01 18:22:21.720 | Traceback (most recent call last):
2017-09-01 18:22:21.720 | File "/usr/local/bin/tox", line 11, in <module>
2017-09-01 18:22:21.720 | sys.exit(cmdline())
2017-09-01 18:22:21.720 | File "/usr/local/lib/python2.7/dist-packages/tox/session.py", line 38, in main
2017-09-01 18:22:21.720 | config = prepare(args)
2017-09-01 18:22:21.720 | File "/usr/local/lib/python2.7/dist-packages/tox/session.py", line 26, in prepare
2017-09-01 18:22:21.720 | config = parseconfig(args)
2017-09-01 18:22:21.720 | File "/usr/local/lib/python2.7/dist-packages/tox/config.py", line 242, in parseconfig
2017-09-01 18:22:21.720 | parseini(config, inipath)
2017-09-01 18:22:21.720 | File "/usr/local/lib/python2.7/dist-packages/tox/config.py", line 796, in __init__
2017-09-01 18:22:21.721 | replace=name in config.envlist)
2017-09-01 18:22:21.721 | File "/usr/local/lib/python2.7/dist-packages/tox/config.py", line 827, in make_envconfig
2017-09-01 18:22:21.721 | res = meth(env_attr.name, env_attr.default, replace=replace)
2017-09-01 18:22:21.721 | File "/usr/local/lib/python2.7/dist-packages/tox/config.py", line 964, in getdict_setenv
2017-09-01 18:22:21.721 | definitions = self._getdict(value, default=default, sep=sep)
2017-09-01 18:22:21.721 | File "/usr/local/lib/python2.7/dist-packages/tox/config.py", line 975, in _getdict
2017-09-01 18:22:21.721 | name, rest = line.split('=', 1)
2017-09-01 18:22:21.721 | ValueError: need more than 1 value to unpack
2017-09-01 18:22:21.733 | + lib/tempest:install_tempest:1 : exit_trap
|
ValueError
|
def setupenv(self, venv):
if venv.envconfig.missing_subs:
venv.status = (
"unresolvable substitution(s): %s. "
"Environment variables are missing or defined recursively."
% (",".join(["'%s'" % m for m in venv.envconfig.missing_subs]))
)
return
if not venv.matching_platform():
venv.status = "platform mismatch"
return # we simply omit non-matching platforms
action = self.newaction(venv, "getenv", venv.envconfig.envdir)
with action:
venv.status = 0
envlog = self.resultlog.get_envlog(venv.name)
try:
status = venv.update(action=action)
except IOError as e:
if e.args[0] != 2:
raise
status = (
"Error creating virtualenv. Note that spaces in paths are "
"not supported by virtualenv. Error details: %r" % e
)
except tox.exception.InvocationError as e:
status = (
"Error creating virtualenv. Note that some special "
"characters (e.g. ':' and unicode symbols) in paths are "
"not supported by virtualenv. Error details: %r" % e
)
if status:
commandlog = envlog.get_commandlog("setup")
commandlog.add_command(["setup virtualenv"], str(status), 1)
venv.status = status
self.report.error(str(status))
return False
commandpath = venv.getcommandpath("python")
envlog.set_python_info(commandpath)
return True
|
def setupenv(self, venv):
if not venv.matching_platform():
venv.status = "platform mismatch"
return # we simply omit non-matching platforms
action = self.newaction(venv, "getenv", venv.envconfig.envdir)
with action:
venv.status = 0
envlog = self.resultlog.get_envlog(venv.name)
try:
status = venv.update(action=action)
except IOError as e:
if e.args[0] != 2:
raise
status = (
"Error creating virtualenv. Note that spaces in paths are "
"not supported by virtualenv. Error details: %r" % e
)
except tox.exception.InvocationError as e:
status = (
"Error creating virtualenv. Note that some special "
"characters (e.g. ':' and unicode symbols) in paths are "
"not supported by virtualenv. Error details: %r" % e
)
if status:
commandlog = envlog.get_commandlog("setup")
commandlog.add_command(["setup virtualenv"], str(status), 1)
venv.status = status
self.report.error(str(status))
return False
commandpath = venv.getcommandpath("python")
envlog.set_python_info(commandpath)
return True
|
https://github.com/tox-dev/tox/issues/595
|
2017-09-01 18:22:20.661 | ++ lib/tempest:install_tempest:612 : pushd /opt/stack/new/tempest
2017-09-01 18:22:20.661 | ~/tempest ~/devstack
2017-09-01 18:22:20.662 | ++ lib/tempest:install_tempest:613 : tox -r --notest -efull
2017-09-01 18:22:21.720 | Traceback (most recent call last):
2017-09-01 18:22:21.720 | File "/usr/local/bin/tox", line 11, in <module>
2017-09-01 18:22:21.720 | sys.exit(cmdline())
2017-09-01 18:22:21.720 | File "/usr/local/lib/python2.7/dist-packages/tox/session.py", line 38, in main
2017-09-01 18:22:21.720 | config = prepare(args)
2017-09-01 18:22:21.720 | File "/usr/local/lib/python2.7/dist-packages/tox/session.py", line 26, in prepare
2017-09-01 18:22:21.720 | config = parseconfig(args)
2017-09-01 18:22:21.720 | File "/usr/local/lib/python2.7/dist-packages/tox/config.py", line 242, in parseconfig
2017-09-01 18:22:21.720 | parseini(config, inipath)
2017-09-01 18:22:21.720 | File "/usr/local/lib/python2.7/dist-packages/tox/config.py", line 796, in __init__
2017-09-01 18:22:21.721 | replace=name in config.envlist)
2017-09-01 18:22:21.721 | File "/usr/local/lib/python2.7/dist-packages/tox/config.py", line 827, in make_envconfig
2017-09-01 18:22:21.721 | res = meth(env_attr.name, env_attr.default, replace=replace)
2017-09-01 18:22:21.721 | File "/usr/local/lib/python2.7/dist-packages/tox/config.py", line 964, in getdict_setenv
2017-09-01 18:22:21.721 | definitions = self._getdict(value, default=default, sep=sep)
2017-09-01 18:22:21.721 | File "/usr/local/lib/python2.7/dist-packages/tox/config.py", line 975, in _getdict
2017-09-01 18:22:21.721 | name, rest = line.split('=', 1)
2017-09-01 18:22:21.721 | ValueError: need more than 1 value to unpack
2017-09-01 18:22:21.733 | + lib/tempest:install_tempest:1 : exit_trap
|
ValueError
|
def write_po(
fileobj,
catalog,
width=76,
no_location=False,
omit_header=False,
sort_output=False,
sort_by_file=False,
ignore_obsolete=False,
include_previous=False,
include_lineno=True,
):
r"""Write a ``gettext`` PO (portable object) template file for a given
message catalog to the provided file-like object.
>>> catalog = Catalog()
>>> catalog.add(u'foo %(name)s', locations=[('main.py', 1)],
... flags=('fuzzy',))
<Message...>
>>> catalog.add((u'bar', u'baz'), locations=[('main.py', 3)])
<Message...>
>>> from babel._compat import BytesIO
>>> buf = BytesIO()
>>> write_po(buf, catalog, omit_header=True)
>>> print(buf.getvalue().decode("utf8"))
#: main.py:1
#, fuzzy, python-format
msgid "foo %(name)s"
msgstr ""
<BLANKLINE>
#: main.py:3
msgid "bar"
msgid_plural "baz"
msgstr[0] ""
msgstr[1] ""
<BLANKLINE>
<BLANKLINE>
:param fileobj: the file-like object to write to
:param catalog: the `Catalog` instance
:param width: the maximum line width for the generated output; use `None`,
0, or a negative number to completely disable line wrapping
:param no_location: do not emit a location comment for every message
:param omit_header: do not include the ``msgid ""`` entry at the top of the
output
:param sort_output: whether to sort the messages in the output by msgid
:param sort_by_file: whether to sort the messages in the output by their
locations
:param ignore_obsolete: whether to ignore obsolete messages and not include
them in the output; by default they are included as
comments
:param include_previous: include the old msgid as a comment when
updating the catalog
:param include_lineno: include line number in the location comment
"""
def _normalize(key, prefix=""):
return normalize(key, prefix=prefix, width=width)
def _write(text):
if isinstance(text, text_type):
text = text.encode(catalog.charset, "backslashreplace")
fileobj.write(text)
def _write_comment(comment, prefix=""):
# xgettext always wraps comments even if --no-wrap is passed;
# provide the same behaviour
if width and width > 0:
_width = width
else:
_width = 76
for line in wraptext(comment, _width):
_write("#%s %s\n" % (prefix, line.strip()))
def _write_message(message, prefix=""):
if isinstance(message.id, (list, tuple)):
if message.context:
_write("%smsgctxt %s\n" % (prefix, _normalize(message.context, prefix)))
_write("%smsgid %s\n" % (prefix, _normalize(message.id[0], prefix)))
_write("%smsgid_plural %s\n" % (prefix, _normalize(message.id[1], prefix)))
for idx in range(catalog.num_plurals):
try:
string = message.string[idx]
except IndexError:
string = ""
_write("%smsgstr[%d] %s\n" % (prefix, idx, _normalize(string, prefix)))
else:
if message.context:
_write("%smsgctxt %s\n" % (prefix, _normalize(message.context, prefix)))
_write("%smsgid %s\n" % (prefix, _normalize(message.id, prefix)))
_write("%smsgstr %s\n" % (prefix, _normalize(message.string or "", prefix)))
sort_by = None
if sort_output:
sort_by = "message"
elif sort_by_file:
sort_by = "location"
for message in _sort_messages(catalog, sort_by=sort_by):
if not message.id: # This is the header "message"
if omit_header:
continue
comment_header = catalog.header_comment
if width and width > 0:
lines = []
for line in comment_header.splitlines():
lines += wraptext(line, width=width, subsequent_indent="# ")
comment_header = "\n".join(lines)
_write(comment_header + "\n")
for comment in message.user_comments:
_write_comment(comment)
for comment in message.auto_comments:
_write_comment(comment, prefix=".")
if not no_location:
locs = []
# Attempt to sort the locations. If we can't do that, for instance
# because there are mixed integers and Nones or whatnot (see issue #606)
# then give up, but also don't just crash.
try:
locations = sorted(message.locations)
except TypeError: # e.g. "TypeError: unorderable types: NoneType() < int()"
locations = message.locations
for filename, lineno in locations:
if lineno and include_lineno:
locs.append("%s:%d" % (filename.replace(os.sep, "/"), lineno))
else:
locs.append("%s" % filename.replace(os.sep, "/"))
_write_comment(" ".join(locs), prefix=":")
if message.flags:
_write("#%s\n" % ", ".join([""] + sorted(message.flags)))
if message.previous_id and include_previous:
_write_comment("msgid %s" % _normalize(message.previous_id[0]), prefix="|")
if len(message.previous_id) > 1:
_write_comment(
"msgid_plural %s" % _normalize(message.previous_id[1]), prefix="|"
)
_write_message(message)
_write("\n")
if not ignore_obsolete:
for message in _sort_messages(catalog.obsolete.values(), sort_by=sort_by):
for comment in message.user_comments:
_write_comment(comment)
_write_message(message, prefix="#~ ")
_write("\n")
|
def write_po(
fileobj,
catalog,
width=76,
no_location=False,
omit_header=False,
sort_output=False,
sort_by_file=False,
ignore_obsolete=False,
include_previous=False,
include_lineno=True,
):
r"""Write a ``gettext`` PO (portable object) template file for a given
message catalog to the provided file-like object.
>>> catalog = Catalog()
>>> catalog.add(u'foo %(name)s', locations=[('main.py', 1)],
... flags=('fuzzy',))
<Message...>
>>> catalog.add((u'bar', u'baz'), locations=[('main.py', 3)])
<Message...>
>>> from babel._compat import BytesIO
>>> buf = BytesIO()
>>> write_po(buf, catalog, omit_header=True)
>>> print(buf.getvalue().decode("utf8"))
#: main.py:1
#, fuzzy, python-format
msgid "foo %(name)s"
msgstr ""
<BLANKLINE>
#: main.py:3
msgid "bar"
msgid_plural "baz"
msgstr[0] ""
msgstr[1] ""
<BLANKLINE>
<BLANKLINE>
:param fileobj: the file-like object to write to
:param catalog: the `Catalog` instance
:param width: the maximum line width for the generated output; use `None`,
0, or a negative number to completely disable line wrapping
:param no_location: do not emit a location comment for every message
:param omit_header: do not include the ``msgid ""`` entry at the top of the
output
:param sort_output: whether to sort the messages in the output by msgid
:param sort_by_file: whether to sort the messages in the output by their
locations
:param ignore_obsolete: whether to ignore obsolete messages and not include
them in the output; by default they are included as
comments
:param include_previous: include the old msgid as a comment when
updating the catalog
:param include_lineno: include line number in the location comment
"""
def _normalize(key, prefix=""):
return normalize(key, prefix=prefix, width=width)
def _write(text):
if isinstance(text, text_type):
text = text.encode(catalog.charset, "backslashreplace")
fileobj.write(text)
def _write_comment(comment, prefix=""):
# xgettext always wraps comments even if --no-wrap is passed;
# provide the same behaviour
if width and width > 0:
_width = width
else:
_width = 76
for line in wraptext(comment, _width):
_write("#%s %s\n" % (prefix, line.strip()))
def _write_message(message, prefix=""):
if isinstance(message.id, (list, tuple)):
if message.context:
_write("%smsgctxt %s\n" % (prefix, _normalize(message.context, prefix)))
_write("%smsgid %s\n" % (prefix, _normalize(message.id[0], prefix)))
_write("%smsgid_plural %s\n" % (prefix, _normalize(message.id[1], prefix)))
for idx in range(catalog.num_plurals):
try:
string = message.string[idx]
except IndexError:
string = ""
_write("%smsgstr[%d] %s\n" % (prefix, idx, _normalize(string, prefix)))
else:
if message.context:
_write("%smsgctxt %s\n" % (prefix, _normalize(message.context, prefix)))
_write("%smsgid %s\n" % (prefix, _normalize(message.id, prefix)))
_write("%smsgstr %s\n" % (prefix, _normalize(message.string or "", prefix)))
sort_by = None
if sort_output:
sort_by = "message"
elif sort_by_file:
sort_by = "location"
for message in _sort_messages(catalog, sort_by=sort_by):
if not message.id: # This is the header "message"
if omit_header:
continue
comment_header = catalog.header_comment
if width and width > 0:
lines = []
for line in comment_header.splitlines():
lines += wraptext(line, width=width, subsequent_indent="# ")
comment_header = "\n".join(lines)
_write(comment_header + "\n")
for comment in message.user_comments:
_write_comment(comment)
for comment in message.auto_comments:
_write_comment(comment, prefix=".")
if not no_location:
locs = []
for filename, lineno in sorted(message.locations):
if lineno and include_lineno:
locs.append("%s:%d" % (filename.replace(os.sep, "/"), lineno))
else:
locs.append("%s" % filename.replace(os.sep, "/"))
_write_comment(" ".join(locs), prefix=":")
if message.flags:
_write("#%s\n" % ", ".join([""] + sorted(message.flags)))
if message.previous_id and include_previous:
_write_comment("msgid %s" % _normalize(message.previous_id[0]), prefix="|")
if len(message.previous_id) > 1:
_write_comment(
"msgid_plural %s" % _normalize(message.previous_id[1]), prefix="|"
)
_write_message(message)
_write("\n")
if not ignore_obsolete:
for message in _sort_messages(catalog.obsolete.values(), sort_by=sort_by):
for comment in message.user_comments:
_write_comment(comment)
_write_message(message, prefix="#~ ")
_write("\n")
|
https://github.com/python-babel/babel/issues/612
|
Not Changed: locale/vi/LC_MESSAGES/animation/actions.po
Traceback (most recent call last):
File "/usr/local/bin/sphinx-intl", line 11, in <module>
sys.exit(main())
File "/usr/local/lib64/python3.6/site-packages/click/core.py", line 764, in __call__
return self.main(*args, **kwargs)
File "/usr/local/lib64/python3.6/site-packages/click/core.py", line 717, in main
rv = self.invoke(ctx)
File "/usr/local/lib64/python3.6/site-packages/click/core.py", line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/local/lib64/python3.6/site-packages/click/core.py", line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib64/python3.6/site-packages/click/core.py", line 555, in invoke
return callback(*args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/sphinx_intl/commands.py", line 256, in update
basic.update(locale_dir, pot_dir, languages)
File "/usr/local/lib/python3.6/site-packages/sphinx_intl/basic.py", line 53, in update
cat = c.load_po(po_file)
File "/usr/local/lib/python3.6/site-packages/sphinx_intl/catalog.py", line 17, in load_po
cat = pofile.read_po(f)
File "/usr/local/lib64/python3.6/site-packages/babel/messages/pofile.py", line 345, in read_po
parser.parse(fileobj)
File "/usr/local/lib64/python3.6/site-packages/babel/messages/pofile.py", line 276, in parse
self._process_comment(line)
File "/usr/local/lib64/python3.6/site-packages/babel/messages/pofile.py", line 235, in _process_comment
self._finish_current_message()
File "/usr/local/lib64/python3.6/site-packages/babel/messages/pofile.py", line 175, in _finish_current_message
self._add_message()
File "/usr/local/lib64/python3.6/site-packages/babel/messages/pofile.py", line 143, in _add_message
self.translations.sort()
TypeError: '<' not supported between instances of '_NormalizedString' and '_NormalizedString'
|
TypeError
|
def get_display_name(self, locale=None):
"""Return the display name of the locale using the given locale.
The display name will include the language, territory, script, and
variant, if those are specified.
>>> Locale('zh', 'CN', script='Hans').get_display_name('en')
u'Chinese (Simplified, China)'
:param locale: the locale to use
"""
if locale is None:
locale = self
locale = Locale.parse(locale)
retval = locale.languages.get(self.language)
if retval and (self.territory or self.script or self.variant):
details = []
if self.script:
details.append(locale.scripts.get(self.script))
if self.territory:
details.append(locale.territories.get(self.territory))
if self.variant:
details.append(locale.variants.get(self.variant))
details = filter(None, details)
if details:
retval += " (%s)" % ", ".join(details)
return retval
|
def get_display_name(self, locale=None):
"""Return the display name of the locale using the given locale.
The display name will include the language, territory, script, and
variant, if those are specified.
>>> Locale('zh', 'CN', script='Hans').get_display_name('en')
u'Chinese (Simplified, China)'
:param locale: the locale to use
"""
if locale is None:
locale = self
locale = Locale.parse(locale)
retval = locale.languages.get(self.language)
if self.territory or self.script or self.variant:
details = []
if self.script:
details.append(locale.scripts.get(self.script))
if self.territory:
details.append(locale.territories.get(self.territory))
if self.variant:
details.append(locale.variants.get(self.variant))
details = filter(None, details)
if details:
retval += " (%s)" % ", ".join(details)
return retval
|
https://github.com/python-babel/babel/issues/601
|
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/will/tmp/babel-bug/env/lib/python3.6/site-packages/babel/core.py", line 392, in get_display_name
retval += ' (%s)' % u', '.join(details)
TypeError: unsupported operand type(s) for +=: 'NoneType' and 'str'
|
TypeError
|
def __init__(
self,
locale=None,
domain=None,
header_comment=DEFAULT_HEADER,
project=None,
version=None,
copyright_holder=None,
msgid_bugs_address=None,
creation_date=None,
revision_date=None,
last_translator=None,
language_team=None,
charset=None,
fuzzy=True,
):
"""Initialize the catalog object.
:param locale: the locale identifier or `Locale` object, or `None`
if the catalog is not bound to a locale (which basically
means it's a template)
:param domain: the message domain
:param header_comment: the header comment as string, or `None` for the
default header
:param project: the project's name
:param version: the project's version
:param copyright_holder: the copyright holder of the catalog
:param msgid_bugs_address: the email address or URL to submit bug
reports to
:param creation_date: the date the catalog was created
:param revision_date: the date the catalog was revised
:param last_translator: the name and email of the last translator
:param language_team: the name and email of the language team
:param charset: the encoding to use in the output (defaults to utf-8)
:param fuzzy: the fuzzy bit on the catalog header
"""
self.domain = domain
self.locale = locale
self._header_comment = header_comment
self._messages = odict()
self.project = project or "PROJECT"
self.version = version or "VERSION"
self.copyright_holder = copyright_holder or "ORGANIZATION"
self.msgid_bugs_address = msgid_bugs_address or "EMAIL@ADDRESS"
self.last_translator = last_translator or "FULL NAME <EMAIL@ADDRESS>"
"""Name and email address of the last translator."""
self.language_team = language_team or "LANGUAGE <LL@li.org>"
"""Name and email address of the language team."""
self.charset = charset or "utf-8"
if creation_date is None:
creation_date = datetime.now(LOCALTZ)
elif isinstance(creation_date, datetime) and not creation_date.tzinfo:
creation_date = creation_date.replace(tzinfo=LOCALTZ)
self.creation_date = creation_date
if revision_date is None:
revision_date = "YEAR-MO-DA HO:MI+ZONE"
elif isinstance(revision_date, datetime) and not revision_date.tzinfo:
revision_date = revision_date.replace(tzinfo=LOCALTZ)
self.revision_date = revision_date
self.fuzzy = fuzzy
self.obsolete = odict() # Dictionary of obsolete messages
self._num_plurals = None
self._plural_expr = None
|
def __init__(
self,
locale=None,
domain=None,
header_comment=DEFAULT_HEADER,
project=None,
version=None,
copyright_holder=None,
msgid_bugs_address=None,
creation_date=None,
revision_date=None,
last_translator=None,
language_team=None,
charset=None,
fuzzy=True,
):
"""Initialize the catalog object.
:param locale: the locale identifier or `Locale` object, or `None`
if the catalog is not bound to a locale (which basically
means it's a template)
:param domain: the message domain
:param header_comment: the header comment as string, or `None` for the
default header
:param project: the project's name
:param version: the project's version
:param copyright_holder: the copyright holder of the catalog
:param msgid_bugs_address: the email address or URL to submit bug
reports to
:param creation_date: the date the catalog was created
:param revision_date: the date the catalog was revised
:param last_translator: the name and email of the last translator
:param language_team: the name and email of the language team
:param charset: the encoding to use in the output (defaults to utf-8)
:param fuzzy: the fuzzy bit on the catalog header
"""
self.domain = domain
if locale:
locale = Locale.parse(locale)
self.locale = locale
self._header_comment = header_comment
self._messages = odict()
self.project = project or "PROJECT"
self.version = version or "VERSION"
self.copyright_holder = copyright_holder or "ORGANIZATION"
self.msgid_bugs_address = msgid_bugs_address or "EMAIL@ADDRESS"
self.last_translator = last_translator or "FULL NAME <EMAIL@ADDRESS>"
"""Name and email address of the last translator."""
self.language_team = language_team or "LANGUAGE <LL@li.org>"
"""Name and email address of the language team."""
self.charset = charset or "utf-8"
if creation_date is None:
creation_date = datetime.now(LOCALTZ)
elif isinstance(creation_date, datetime) and not creation_date.tzinfo:
creation_date = creation_date.replace(tzinfo=LOCALTZ)
self.creation_date = creation_date
if revision_date is None:
revision_date = "YEAR-MO-DA HO:MI+ZONE"
elif isinstance(revision_date, datetime) and not revision_date.tzinfo:
revision_date = revision_date.replace(tzinfo=LOCALTZ)
self.revision_date = revision_date
self.fuzzy = fuzzy
self.obsolete = odict() # Dictionary of obsolete messages
self._num_plurals = None
self._plural_expr = None
|
https://github.com/python-babel/babel/issues/555
|
Traceback (most recent call last):
File "/usr/local/bin/pybabel", line 11, in <module>
sys.exit(main())
File "/usr/local/lib/python3.5/dist-packages/babel/messages/frontend.py", line 908, in main
return CommandLineInterface().run(sys.argv)
File "/usr/local/lib/python3.5/dist-packages/babel/messages/frontend.py", line 832, in run
return cmdinst.run()
File "/usr/local/lib/python3.5/dist-packages/babel/messages/frontend.py", line 182, in run
self._run_domain(domain)
File "/usr/local/lib/python3.5/dist-packages/babel/messages/frontend.py", line 221, in _run_domain
catalog = read_po(infile, locale)
File "/usr/local/lib/python3.5/dist-packages/babel/messages/pofile.py", line 331, in read_po
parser.parse(fileobj)
File "/usr/local/lib/python3.5/dist-packages/babel/messages/pofile.py", line 265, in parse
self._process_comment(line)
File "/usr/local/lib/python3.5/dist-packages/babel/messages/pofile.py", line 224, in _process_comment
self._finish_current_message()
File "/usr/local/lib/python3.5/dist-packages/babel/messages/pofile.py", line 164, in _finish_current_message
self._add_message()
File "/usr/local/lib/python3.5/dist-packages/babel/messages/pofile.py", line 158, in _add_message
self.catalog[msgid] = message
File "/usr/local/lib/python3.5/dist-packages/babel/messages/catalog.py", line 596, in __setitem__
self.mime_headers = _parse_header(message.string).items()
File "/usr/local/lib/python3.5/dist-packages/babel/messages/catalog.py", line 399, in _set_mime_headers
self.locale = Locale.parse(value)
File "/usr/local/lib/python3.5/dist-packages/babel/core.py", line 331, in parse
raise UnknownLocaleError(input_id)
babel.core.UnknownLocaleError: unknown locale 'sr_SP'
|
babel.core.UnknownLocaleError
|
def _get_header_comment(self):
comment = self._header_comment
year = datetime.now(LOCALTZ).strftime("%Y")
if hasattr(self.revision_date, "strftime"):
year = self.revision_date.strftime("%Y")
comment = (
comment.replace("PROJECT", self.project)
.replace("VERSION", self.version)
.replace("YEAR", year)
.replace("ORGANIZATION", self.copyright_holder)
)
locale_name = self.locale.english_name if self.locale else self.locale_identifier
if locale_name:
comment = comment.replace(
"Translations template", "%s translations" % locale_name
)
return comment
|
def _get_header_comment(self):
comment = self._header_comment
year = datetime.now(LOCALTZ).strftime("%Y")
if hasattr(self.revision_date, "strftime"):
year = self.revision_date.strftime("%Y")
comment = (
comment.replace("PROJECT", self.project)
.replace("VERSION", self.version)
.replace("YEAR", year)
.replace("ORGANIZATION", self.copyright_holder)
)
if self.locale:
comment = comment.replace(
"Translations template", "%s translations" % self.locale.english_name
)
return comment
|
https://github.com/python-babel/babel/issues/555
|
Traceback (most recent call last):
File "/usr/local/bin/pybabel", line 11, in <module>
sys.exit(main())
File "/usr/local/lib/python3.5/dist-packages/babel/messages/frontend.py", line 908, in main
return CommandLineInterface().run(sys.argv)
File "/usr/local/lib/python3.5/dist-packages/babel/messages/frontend.py", line 832, in run
return cmdinst.run()
File "/usr/local/lib/python3.5/dist-packages/babel/messages/frontend.py", line 182, in run
self._run_domain(domain)
File "/usr/local/lib/python3.5/dist-packages/babel/messages/frontend.py", line 221, in _run_domain
catalog = read_po(infile, locale)
File "/usr/local/lib/python3.5/dist-packages/babel/messages/pofile.py", line 331, in read_po
parser.parse(fileobj)
File "/usr/local/lib/python3.5/dist-packages/babel/messages/pofile.py", line 265, in parse
self._process_comment(line)
File "/usr/local/lib/python3.5/dist-packages/babel/messages/pofile.py", line 224, in _process_comment
self._finish_current_message()
File "/usr/local/lib/python3.5/dist-packages/babel/messages/pofile.py", line 164, in _finish_current_message
self._add_message()
File "/usr/local/lib/python3.5/dist-packages/babel/messages/pofile.py", line 158, in _add_message
self.catalog[msgid] = message
File "/usr/local/lib/python3.5/dist-packages/babel/messages/catalog.py", line 596, in __setitem__
self.mime_headers = _parse_header(message.string).items()
File "/usr/local/lib/python3.5/dist-packages/babel/messages/catalog.py", line 399, in _set_mime_headers
self.locale = Locale.parse(value)
File "/usr/local/lib/python3.5/dist-packages/babel/core.py", line 331, in parse
raise UnknownLocaleError(input_id)
babel.core.UnknownLocaleError: unknown locale 'sr_SP'
|
babel.core.UnknownLocaleError
|
def _get_mime_headers(self):
headers = []
headers.append(("Project-Id-Version", "%s %s" % (self.project, self.version)))
headers.append(("Report-Msgid-Bugs-To", self.msgid_bugs_address))
headers.append(
(
"POT-Creation-Date",
format_datetime(self.creation_date, "yyyy-MM-dd HH:mmZ", locale="en"),
)
)
if isinstance(self.revision_date, (datetime, time_) + number_types):
headers.append(
(
"PO-Revision-Date",
format_datetime(self.revision_date, "yyyy-MM-dd HH:mmZ", locale="en"),
)
)
else:
headers.append(("PO-Revision-Date", self.revision_date))
headers.append(("Last-Translator", self.last_translator))
if self.locale_identifier:
headers.append(("Language", str(self.locale_identifier)))
if self.locale_identifier and ("LANGUAGE" in self.language_team):
headers.append(
(
"Language-Team",
self.language_team.replace("LANGUAGE", str(self.locale_identifier)),
)
)
else:
headers.append(("Language-Team", self.language_team))
if self.locale is not None:
headers.append(("Plural-Forms", self.plural_forms))
headers.append(("MIME-Version", "1.0"))
headers.append(("Content-Type", "text/plain; charset=%s" % self.charset))
headers.append(("Content-Transfer-Encoding", "8bit"))
headers.append(("Generated-By", "Babel %s\n" % VERSION))
return headers
|
def _get_mime_headers(self):
headers = []
headers.append(("Project-Id-Version", "%s %s" % (self.project, self.version)))
headers.append(("Report-Msgid-Bugs-To", self.msgid_bugs_address))
headers.append(
(
"POT-Creation-Date",
format_datetime(self.creation_date, "yyyy-MM-dd HH:mmZ", locale="en"),
)
)
if isinstance(self.revision_date, (datetime, time_) + number_types):
headers.append(
(
"PO-Revision-Date",
format_datetime(self.revision_date, "yyyy-MM-dd HH:mmZ", locale="en"),
)
)
else:
headers.append(("PO-Revision-Date", self.revision_date))
headers.append(("Last-Translator", self.last_translator))
if self.locale is not None:
headers.append(("Language", str(self.locale)))
if (self.locale is not None) and ("LANGUAGE" in self.language_team):
headers.append(
("Language-Team", self.language_team.replace("LANGUAGE", str(self.locale)))
)
else:
headers.append(("Language-Team", self.language_team))
if self.locale is not None:
headers.append(("Plural-Forms", self.plural_forms))
headers.append(("MIME-Version", "1.0"))
headers.append(("Content-Type", "text/plain; charset=%s" % self.charset))
headers.append(("Content-Transfer-Encoding", "8bit"))
headers.append(("Generated-By", "Babel %s\n" % VERSION))
return headers
|
https://github.com/python-babel/babel/issues/555
|
Traceback (most recent call last):
File "/usr/local/bin/pybabel", line 11, in <module>
sys.exit(main())
File "/usr/local/lib/python3.5/dist-packages/babel/messages/frontend.py", line 908, in main
return CommandLineInterface().run(sys.argv)
File "/usr/local/lib/python3.5/dist-packages/babel/messages/frontend.py", line 832, in run
return cmdinst.run()
File "/usr/local/lib/python3.5/dist-packages/babel/messages/frontend.py", line 182, in run
self._run_domain(domain)
File "/usr/local/lib/python3.5/dist-packages/babel/messages/frontend.py", line 221, in _run_domain
catalog = read_po(infile, locale)
File "/usr/local/lib/python3.5/dist-packages/babel/messages/pofile.py", line 331, in read_po
parser.parse(fileobj)
File "/usr/local/lib/python3.5/dist-packages/babel/messages/pofile.py", line 265, in parse
self._process_comment(line)
File "/usr/local/lib/python3.5/dist-packages/babel/messages/pofile.py", line 224, in _process_comment
self._finish_current_message()
File "/usr/local/lib/python3.5/dist-packages/babel/messages/pofile.py", line 164, in _finish_current_message
self._add_message()
File "/usr/local/lib/python3.5/dist-packages/babel/messages/pofile.py", line 158, in _add_message
self.catalog[msgid] = message
File "/usr/local/lib/python3.5/dist-packages/babel/messages/catalog.py", line 596, in __setitem__
self.mime_headers = _parse_header(message.string).items()
File "/usr/local/lib/python3.5/dist-packages/babel/messages/catalog.py", line 399, in _set_mime_headers
self.locale = Locale.parse(value)
File "/usr/local/lib/python3.5/dist-packages/babel/core.py", line 331, in parse
raise UnknownLocaleError(input_id)
babel.core.UnknownLocaleError: unknown locale 'sr_SP'
|
babel.core.UnknownLocaleError
|
def _set_mime_headers(self, headers):
for name, value in headers:
name = name.lower()
if name == "project-id-version":
parts = value.split(" ")
self.project = " ".join(parts[:-1])
self.version = parts[-1]
elif name == "report-msgid-bugs-to":
self.msgid_bugs_address = value
elif name == "last-translator":
self.last_translator = value
elif name == "language":
value = value.replace("-", "_")
self._set_locale(value)
elif name == "language-team":
self.language_team = value
elif name == "content-type":
mimetype, params = parse_header(value)
if "charset" in params:
self.charset = params["charset"].lower()
elif name == "plural-forms":
_, params = parse_header(" ;" + value)
self._num_plurals = int(params.get("nplurals", 2))
self._plural_expr = params.get("plural", "(n != 1)")
elif name == "pot-creation-date":
self.creation_date = _parse_datetime_header(value)
elif name == "po-revision-date":
# Keep the value if it's not the default one
if "YEAR" not in value:
self.revision_date = _parse_datetime_header(value)
|
def _set_mime_headers(self, headers):
for name, value in headers:
name = name.lower()
if name == "project-id-version":
parts = value.split(" ")
self.project = " ".join(parts[:-1])
self.version = parts[-1]
elif name == "report-msgid-bugs-to":
self.msgid_bugs_address = value
elif name == "last-translator":
self.last_translator = value
elif name == "language":
value = value.replace("-", "_")
self.locale = Locale.parse(value)
elif name == "language-team":
self.language_team = value
elif name == "content-type":
mimetype, params = parse_header(value)
if "charset" in params:
self.charset = params["charset"].lower()
elif name == "plural-forms":
_, params = parse_header(" ;" + value)
self._num_plurals = int(params.get("nplurals", 2))
self._plural_expr = params.get("plural", "(n != 1)")
elif name == "pot-creation-date":
self.creation_date = _parse_datetime_header(value)
elif name == "po-revision-date":
# Keep the value if it's not the default one
if "YEAR" not in value:
self.revision_date = _parse_datetime_header(value)
|
https://github.com/python-babel/babel/issues/555
|
Traceback (most recent call last):
File "/usr/local/bin/pybabel", line 11, in <module>
sys.exit(main())
File "/usr/local/lib/python3.5/dist-packages/babel/messages/frontend.py", line 908, in main
return CommandLineInterface().run(sys.argv)
File "/usr/local/lib/python3.5/dist-packages/babel/messages/frontend.py", line 832, in run
return cmdinst.run()
File "/usr/local/lib/python3.5/dist-packages/babel/messages/frontend.py", line 182, in run
self._run_domain(domain)
File "/usr/local/lib/python3.5/dist-packages/babel/messages/frontend.py", line 221, in _run_domain
catalog = read_po(infile, locale)
File "/usr/local/lib/python3.5/dist-packages/babel/messages/pofile.py", line 331, in read_po
parser.parse(fileobj)
File "/usr/local/lib/python3.5/dist-packages/babel/messages/pofile.py", line 265, in parse
self._process_comment(line)
File "/usr/local/lib/python3.5/dist-packages/babel/messages/pofile.py", line 224, in _process_comment
self._finish_current_message()
File "/usr/local/lib/python3.5/dist-packages/babel/messages/pofile.py", line 164, in _finish_current_message
self._add_message()
File "/usr/local/lib/python3.5/dist-packages/babel/messages/pofile.py", line 158, in _add_message
self.catalog[msgid] = message
File "/usr/local/lib/python3.5/dist-packages/babel/messages/catalog.py", line 596, in __setitem__
self.mime_headers = _parse_header(message.string).items()
File "/usr/local/lib/python3.5/dist-packages/babel/messages/catalog.py", line 399, in _set_mime_headers
self.locale = Locale.parse(value)
File "/usr/local/lib/python3.5/dist-packages/babel/core.py", line 331, in parse
raise UnknownLocaleError(input_id)
babel.core.UnknownLocaleError: unknown locale 'sr_SP'
|
babel.core.UnknownLocaleError
|
def plural_expr(self):
"""The plural expression used by the catalog or locale.
>>> Catalog(locale='en').plural_expr
'(n != 1)'
>>> Catalog(locale='ga').plural_expr
'(n==1 ? 0 : n==2 ? 1 : n>=3 && n<=6 ? 2 : n>=7 && n<=10 ? 3 : 4)'
>>> Catalog(locale='ding').plural_expr # unknown locale
'(n != 1)'
:type: `string_types`"""
if self._plural_expr is None:
expr = "(n != 1)"
if self.locale:
expr = get_plural(self.locale)[1]
self._plural_expr = expr
return self._plural_expr
|
def plural_expr(self):
"""The plural expression used by the catalog or locale.
>>> Catalog(locale='en').plural_expr
'(n != 1)'
>>> Catalog(locale='ga').plural_expr
'(n==1 ? 0 : n==2 ? 1 : n>=3 && n<=6 ? 2 : n>=7 && n<=10 ? 3 : 4)'
:type: `string_types`"""
if self._plural_expr is None:
expr = "(n != 1)"
if self.locale:
expr = get_plural(self.locale)[1]
self._plural_expr = expr
return self._plural_expr
|
https://github.com/python-babel/babel/issues/555
|
Traceback (most recent call last):
File "/usr/local/bin/pybabel", line 11, in <module>
sys.exit(main())
File "/usr/local/lib/python3.5/dist-packages/babel/messages/frontend.py", line 908, in main
return CommandLineInterface().run(sys.argv)
File "/usr/local/lib/python3.5/dist-packages/babel/messages/frontend.py", line 832, in run
return cmdinst.run()
File "/usr/local/lib/python3.5/dist-packages/babel/messages/frontend.py", line 182, in run
self._run_domain(domain)
File "/usr/local/lib/python3.5/dist-packages/babel/messages/frontend.py", line 221, in _run_domain
catalog = read_po(infile, locale)
File "/usr/local/lib/python3.5/dist-packages/babel/messages/pofile.py", line 331, in read_po
parser.parse(fileobj)
File "/usr/local/lib/python3.5/dist-packages/babel/messages/pofile.py", line 265, in parse
self._process_comment(line)
File "/usr/local/lib/python3.5/dist-packages/babel/messages/pofile.py", line 224, in _process_comment
self._finish_current_message()
File "/usr/local/lib/python3.5/dist-packages/babel/messages/pofile.py", line 164, in _finish_current_message
self._add_message()
File "/usr/local/lib/python3.5/dist-packages/babel/messages/pofile.py", line 158, in _add_message
self.catalog[msgid] = message
File "/usr/local/lib/python3.5/dist-packages/babel/messages/catalog.py", line 596, in __setitem__
self.mime_headers = _parse_header(message.string).items()
File "/usr/local/lib/python3.5/dist-packages/babel/messages/catalog.py", line 399, in _set_mime_headers
self.locale = Locale.parse(value)
File "/usr/local/lib/python3.5/dist-packages/babel/core.py", line 331, in parse
raise UnknownLocaleError(input_id)
babel.core.UnknownLocaleError: unknown locale 'sr_SP'
|
babel.core.UnknownLocaleError
|
def __getitem__(self, name):
char = name[0]
num = len(name)
if char == "G":
return self.format_era(char, num)
elif char in ("y", "Y", "u"):
return self.format_year(char, num)
elif char in ("Q", "q"):
return self.format_quarter(char, num)
elif char in ("M", "L"):
return self.format_month(char, num)
elif char in ("w", "W"):
return self.format_week(char, num)
elif char == "d":
return self.format(self.value.day, num)
elif char == "D":
return self.format_day_of_year(num)
elif char == "F":
return self.format_day_of_week_in_month()
elif char in ("E", "e", "c"):
return self.format_weekday(char, num)
elif char == "a":
# TODO: Add support for the rest of the period formats (a*, b*, B*)
return self.format_period(char)
elif char == "h":
if self.value.hour % 12 == 0:
return self.format(12, num)
else:
return self.format(self.value.hour % 12, num)
elif char == "H":
return self.format(self.value.hour, num)
elif char == "K":
return self.format(self.value.hour % 12, num)
elif char == "k":
if self.value.hour == 0:
return self.format(24, num)
else:
return self.format(self.value.hour, num)
elif char == "m":
return self.format(self.value.minute, num)
elif char == "s":
return self.format(self.value.second, num)
elif char == "S":
return self.format_frac_seconds(num)
elif char == "A":
return self.format_milliseconds_in_day(num)
elif char in ("z", "Z", "v", "V", "x", "X", "O"):
return self.format_timezone(char, num)
else:
raise KeyError("Unsupported date/time field %r" % char)
|
def __getitem__(self, name):
char = name[0]
num = len(name)
if char == "G":
return self.format_era(char, num)
elif char in ("y", "Y", "u"):
return self.format_year(char, num)
elif char in ("Q", "q"):
return self.format_quarter(char, num)
elif char in ("M", "L"):
return self.format_month(char, num)
elif char in ("w", "W"):
return self.format_week(char, num)
elif char == "d":
return self.format(self.value.day, num)
elif char == "D":
return self.format_day_of_year(num)
elif char == "F":
return self.format_day_of_week_in_month()
elif char in ("E", "e", "c"):
return self.format_weekday(char, num)
elif char == "a":
return self.format_period(char)
elif char == "h":
if self.value.hour % 12 == 0:
return self.format(12, num)
else:
return self.format(self.value.hour % 12, num)
elif char == "H":
return self.format(self.value.hour, num)
elif char == "K":
return self.format(self.value.hour % 12, num)
elif char == "k":
if self.value.hour == 0:
return self.format(24, num)
else:
return self.format(self.value.hour, num)
elif char == "m":
return self.format(self.value.minute, num)
elif char == "s":
return self.format(self.value.second, num)
elif char == "S":
return self.format_frac_seconds(num)
elif char == "A":
return self.format_milliseconds_in_day(num)
elif char in ("z", "Z", "v", "V", "x", "X", "O"):
return self.format_timezone(char, num)
else:
raise KeyError("Unsupported date/time field %r" % char)
|
https://github.com/python-babel/babel/issues/378
|
import babel
babel.__version__
'2.3.1'
from datetime import datetime
from babel.dates import format_time
format_time(datetime(2016, 4, 8, 12, 34, 56), locale='zh_TW')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/dev/shm/babel231/local/lib/python2.7/site-packages/babel/dates.py", line 787, in format_time
return parse_pattern(format).apply(time, locale)
File "/dev/shm/babel231/local/lib/python2.7/site-packages/babel/dates.py", line 1208, in apply
return self % DateTimeFormat(datetime, locale)
File "/dev/shm/babel231/local/lib/python2.7/site-packages/babel/dates.py", line 1205, in __mod__
return self.format % other
File "/dev/shm/babel231/local/lib/python2.7/site-packages/babel/dates.py", line 1242, in __getitem__
return self.format_period(char)
File "/dev/shm/babel231/local/lib/python2.7/site-packages/babel/dates.py", line 1384, in format_period
return get_period_names(locale=self.locale)[period]
File "/dev/shm/babel231/local/lib/python2.7/site-packages/babel/localedata.py", line 207, in __getitem__
orig = val = self._data[key]
KeyError: 'pm'
|
KeyError
|
def format_period(self, char):
period = {0: "am", 1: "pm"}[int(self.value.hour >= 12)]
for width in ("wide", "narrow", "abbreviated"):
period_names = get_period_names(
context="format", width=width, locale=self.locale
)
if period in period_names:
return period_names[period]
raise ValueError("Could not format period %s in %s" % (period, self.locale))
|
def format_period(self, char):
period = {0: "am", 1: "pm"}[int(self.value.hour >= 12)]
return get_period_names(locale=self.locale)[period]
|
https://github.com/python-babel/babel/issues/378
|
import babel
babel.__version__
'2.3.1'
from datetime import datetime
from babel.dates import format_time
format_time(datetime(2016, 4, 8, 12, 34, 56), locale='zh_TW')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/dev/shm/babel231/local/lib/python2.7/site-packages/babel/dates.py", line 787, in format_time
return parse_pattern(format).apply(time, locale)
File "/dev/shm/babel231/local/lib/python2.7/site-packages/babel/dates.py", line 1208, in apply
return self % DateTimeFormat(datetime, locale)
File "/dev/shm/babel231/local/lib/python2.7/site-packages/babel/dates.py", line 1205, in __mod__
return self.format % other
File "/dev/shm/babel231/local/lib/python2.7/site-packages/babel/dates.py", line 1242, in __getitem__
return self.format_period(char)
File "/dev/shm/babel231/local/lib/python2.7/site-packages/babel/dates.py", line 1384, in format_period
return get_period_names(locale=self.locale)[period]
File "/dev/shm/babel231/local/lib/python2.7/site-packages/babel/localedata.py", line 207, in __getitem__
orig = val = self._data[key]
KeyError: 'pm'
|
KeyError
|
def check_http_service(endpoint):
if endpoint.family == socket.AF_INET:
url = "http://{host}:{port}/health".format(
host=endpoint.address.host, port=endpoint.address.port
)
elif endpoint.family == socket.AF_UNIX:
quoted_path = quote(endpoint.address, safe="")
url = "http+unix://{path}/health".format(path=quoted_path)
else:
raise ValueError("unrecognized socket family %r" % endpoint.family)
session = requests.Session()
add_unix_socket_support(session)
response = session.get(url, timeout=TIMEOUT)
response.raise_for_status()
response.json()
|
def check_http_service(endpoint):
if endpoint.family == socket.AF_INET:
url = "http://{host}:{port}/health".format(
host=endpoint.address.host, port=endpoint.address.port
)
elif endpoint.family == socket.AF_UNIX:
quoted_path = urllib.quote(endpoint.address, safe="")
url = "http+unix://{path}/health".format(path=quoted_path)
else:
raise ValueError("unrecognized socket family %r" % endpoint.family)
session = requests.Session()
add_unix_socket_support(session)
response = session.get(url, timeout=TIMEOUT)
response.raise_for_status()
response.json()
|
https://github.com/reddit/baseplate.py/issues/157
|
Traceback (most recent call last):
File "/usr/local/bin/baseplate-healthcheck3", line 9, in <module>
load_entry_point('baseplate', 'console_scripts', 'baseplate-healthcheck3')()
File "/usr/lib/python3/dist-packages/baseplate/server/healthcheck.py", line 68, in run_healthchecks
checker(args.endpoint)
File "/usr/lib/python3/dist-packages/baseplate/server/healthcheck.py", line 35, in check_http_service
quoted_path = urllib.quote(endpoint.address, safe="")
AttributeError: 'module' object has no attribute 'quote'
|
AttributeError
|
def get_private_keys():
"""Find SSH keys in standard folder."""
key_formats = [RSAKey, ECDSAKey, Ed25519Key]
ssh_folder = os.path.expanduser("~/.ssh")
available_private_keys = []
if os.path.isdir(ssh_folder):
for key in os.listdir(ssh_folder):
key_file = os.path.join(ssh_folder, key)
if not os.path.isfile(key_file):
continue
for key_format in key_formats:
try:
parsed_key = key_format.from_private_key_file(key_file)
key_details = {
"filename": key,
"format": parsed_key.get_name(),
"bits": parsed_key.get_bits(),
"fingerprint": parsed_key.get_fingerprint().hex(),
}
available_private_keys.append(key_details)
except (
SSHException,
UnicodeDecodeError,
IsADirectoryError,
IndexError,
ValueError,
PermissionError,
):
continue
except OSError as e:
if e.errno == errno.ENXIO:
# when key_file is a (ControlPath) socket
continue
else:
raise
return available_private_keys
|
def get_private_keys():
"""Find SSH keys in standard folder."""
key_formats = [RSAKey, ECDSAKey, Ed25519Key]
ssh_folder = os.path.expanduser("~/.ssh")
available_private_keys = []
if os.path.isdir(ssh_folder):
for key in os.listdir(ssh_folder):
key_file = os.path.join(ssh_folder, key)
if not os.path.isfile(key_file):
continue
for key_format in key_formats:
try:
parsed_key = key_format.from_private_key_file(key_file)
key_details = {
"filename": key,
"format": parsed_key.get_name(),
"bits": parsed_key.get_bits(),
"fingerprint": parsed_key.get_fingerprint().hex(),
}
available_private_keys.append(key_details)
except (
SSHException,
UnicodeDecodeError,
IsADirectoryError,
IndexError,
):
continue
except OSError as e:
if e.errno == errno.ENXIO:
# when key_file is a (ControlPath) socket
continue
else:
raise
return available_private_keys
|
https://github.com/borgbase/vorta/issues/725
|
2020-11-24 00:24:57,883 - vorta.i18n - DEBUG - Loading translation succeeded for ['de', 'de-DE', 'de-Latn-DE'].
2020-11-24 00:24:57,912 - apscheduler.scheduler - INFO - Scheduler started
2020-11-24 00:24:57,914 - apscheduler.scheduler - INFO - Added job "VortaScheduler.create_backup" to job store "default"
2020-11-24 00:24:57,914 - vorta.scheduler - DEBUG - New job for profile Default was added.
2020-11-24 00:24:57,981 - vorta.borg.borg_thread - INFO - Running command /usr/local/bin/borg --version
CoreSVG has logged an error. Set environment variabe "CORESVG_VERBOSE" to learn more.
Traceback (most recent call last):
File "application.py", line 90, in open_main_window_action
File "views/main_window.py", line 47, in __init__
File "views/repo_tab.py", line 54, in __init__
File "views/repo_tab.py", line 100, in init_ssh
File "utils.py", line 84, in get_private_keys
File "paramiko/pkey.py", line 235, in from_private_key_file
File "paramiko/rsakey.py", line 55, in __init__
File "paramiko/rsakey.py", line 176, in _from_private_key_file
File "paramiko/rsakey.py", line 194, in _decode_key
File "cryptography/hazmat/primitives/asymmetric/rsa.py", line 308, in private_key
File "cryptography/hazmat/backends/openssl/backend.py", line 517, in load_rsa_private_numbers
File "cryptography/hazmat/primitives/asymmetric/rsa.py", line 171, in _check_private_key_components
ValueError: p*q must equal modulus.
zsh: abort /Applications/Vorta.app/Contents/MacOS/vorta-darwin
|
ValueError
|
def prepare(cls, profile):
"""
Prepare for running Borg. This function in the base class should be called from all
subclasses and calls that define their own `cmd`.
The `prepare()` step does these things:
- validate if all conditions to run command are met
- build borg command
`prepare()` is run 2x. First at the global level and then for each subcommand.
:return: dict(ok: book, message: str)
"""
ret = {"ok": False}
# Do checks to see if running Borg is possible.
if cls.is_running():
ret["message"] = trans_late("messages", "Backup is already in progress.")
return ret
if cls.prepare_bin() is None:
ret["message"] = trans_late("messages", "Borg binary was not found.")
return ret
if profile.repo is None:
ret["message"] = trans_late("messages", "Add a backup repository first.")
return ret
if not borg_compat.check("JSON_LOG"):
ret["message"] = trans_late(
"messages", "Your Borg version is too old. >=1.1.0 is required."
)
return ret
# Try to get password from chosen keyring backend.
keyring = get_keyring()
logger.debug("Using %s keyring to store passwords.", keyring.__class__.__name__)
ret["password"] = keyring.get_password("vorta-repo", profile.repo.url)
# Check if keyring is locked
if profile.repo.encryption != "none" and not keyring.is_unlocked:
ret["message"] = trans_late("messages", "Please unlock your password manager.")
return ret
# Try to fall back to DB Keyring, if we use the system keychain.
if ret["password"] is None and keyring.is_primary:
logger.debug(
"Password not found in primary keyring. Falling back to VortaDBKeyring."
)
ret["password"] = VortaDBKeyring().get_password("vorta-repo", profile.repo.url)
# Give warning and continue if password is found there.
if ret["password"] is not None:
logger.warning(
"Found password in database, but secure storage was available. "
"Consider re-adding the repo to use it."
)
ret["ssh_key"] = profile.ssh_key
ret["repo_id"] = profile.repo.id
ret["repo_url"] = profile.repo.url
ret["extra_borg_arguments"] = profile.repo.extra_borg_arguments
ret["profile_name"] = profile.name
ret["ok"] = True
return ret
|
def prepare(cls, profile):
"""
Prepare for running Borg. This function in the base class should be called from all
subclasses and calls that define their own `cmd`.
The `prepare()` step does these things:
- validate if all conditions to run command are met
- build borg command
`prepare()` is run 2x. First at the global level and then for each subcommand.
:return: dict(ok: book, message: str)
"""
ret = {"ok": False}
# Do checks to see if running Borg is possible.
if cls.is_running():
ret["message"] = trans_late("messages", "Backup is already in progress.")
return ret
if cls.prepare_bin() is None:
ret["message"] = trans_late("messages", "Borg binary was not found.")
return ret
if profile.repo is None:
ret["message"] = trans_late("messages", "Add a backup repository first.")
return ret
if not borg_compat.check("JSON_LOG"):
ret["message"] = trans_late(
"messages", "Your Borg version is too old. >=1.1.0 is required."
)
return ret
# Try to get password from chosen keyring backend.
keyring = get_keyring()
logger.debug("Using %s keyring to store passwords.", keyring.__class__.__name__)
ret["password"] = keyring.get_password("vorta-repo", profile.repo.url)
# Try to fall back to DB Keyring, if we use the system keychain.
if ret["password"] is None and keyring.is_primary:
logger.debug(
"Password not found in primary keyring. Falling back to VortaDBKeyring."
)
ret["password"] = VortaDBKeyring().get_password("vorta-repo", profile.repo.url)
# Give warning and continue if password is found there.
if ret["password"] is not None:
logger.warning(
"Found password in database, but secure storage was available. "
"Consider re-adding the repo to use it."
)
ret["ssh_key"] = profile.ssh_key
ret["repo_id"] = profile.repo.id
ret["repo_url"] = profile.repo.url
ret["extra_borg_arguments"] = profile.repo.extra_borg_arguments
ret["profile_name"] = profile.name
ret["ok"] = True
return ret
|
https://github.com/borgbase/vorta/issues/606
|
2020-08-31 20:53:34,066 - vorta.borg.borg_thread - DEBUG - Using VortaSecretStorageKeyring keyring to store passwords.
2020-08-31 20:53:34,066 - asyncio - DEBUG - Using selector: EpollSelector
Traceback (most recent call last):
File "/home/user/.local/lib/python3.8/site-packages/vorta/views/repo_add_dialog.py", line 64, in run
params = BorgInitThread.prepare(self.values)
File "/home/user/.local/lib/python3.8/site-packages/vorta/borg/init.py", line 20, in prepare
ret = super().prepare(profile)
File "/home/user/.local/lib/python3.8/site-packages/vorta/borg/borg_thread.py", line 121, in prepare
ret['password'] = keyring.get_password('vorta-repo', profile.repo.url)
File "/home/user/.local/lib/python3.8/site-packages/vorta/keyring/secretstorage.py", line 30, in get_password
collection = secretstorage.get_default_collection(self.connection)
File "/usr/lib/python3/dist-packages/secretstorage/collection.py", line 155, in get_default_collection
return Collection(bus)
File "/usr/lib/python3/dist-packages/secretstorage/collection.py", line 42, in __init__
self.collection_props_iface.Get(COLLECTION_IFACE, 'Label',
File "/usr/lib/python3/dist-packages/secretstorage/util.py", line 31, in function_out
return function_in(*args, **kwargs)
File "/usr/lib/python3/dist-packages/dbus/proxies.py", line 141, in __call__
return self._connection.call_blocking(self._named_service,
File "/usr/lib/python3/dist-packages/dbus/connection.py", line 652, in call_blocking
reply_message = self.send_message_with_reply_and_block(
dbus.exceptions.DBusException: org.freedesktop.DBus.Error.UnknownObject: No such object path '/org/freedesktop/secrets/aliases/default'
|
dbus.exceptions.DBusException
|
def prepare(cls, params):
"""
Used to validate existing repository when added.
"""
# Build fake profile because we don't have it in the DB yet. Assume unencrypted.
profile = FakeProfile(
FakeRepo(params["repo_url"], 999, params["extra_borg_arguments"], "none"),
"New Repo",
params["ssh_key"],
)
ret = super().prepare(profile)
if not ret["ok"]:
return ret
else:
ret["ok"] = False # Set back to false, so we can do our own checks here.
cmd = ["borg", "info", "--info", "--json", "--log-json"]
cmd.append(profile.repo.url)
ret["additional_env"] = {
"BORG_UNKNOWN_UNENCRYPTED_REPO_ACCESS_IS_OK": "yes",
"BORG_RSH": "ssh -oStrictHostKeyChecking=no",
}
if params["password"] == "":
ret["password"] = (
"999999" # Dummy password if the user didn't supply one. To avoid prompt.
)
else:
ret["password"] = params["password"]
# Cannot tell if repo has encryption, assuming based off of password
if not get_keyring().is_unlocked:
ret["message"] = trans_late(
"messages", "Please unlock your password manager."
)
return ret
ret["ok"] = True
ret["cmd"] = cmd
return ret
|
def prepare(cls, params):
"""
Used to validate existing repository when added.
"""
# Build fake profile because we don't have it in the DB yet.
profile = FakeProfile(
FakeRepo(params["repo_url"], 999, params["extra_borg_arguments"]),
"New Repo",
params["ssh_key"],
)
ret = super().prepare(profile)
if not ret["ok"]:
return ret
else:
ret["ok"] = False # Set back to false, so we can do our own checks here.
cmd = ["borg", "info", "--info", "--json", "--log-json"]
cmd.append(profile.repo.url)
ret["additional_env"] = {
"BORG_UNKNOWN_UNENCRYPTED_REPO_ACCESS_IS_OK": "yes",
"BORG_RSH": "ssh -oStrictHostKeyChecking=no",
}
if params["password"] == "":
ret["password"] = (
"999999" # Dummy password if the user didn't supply one. To avoid prompt.
)
else:
ret["password"] = params["password"]
ret["ok"] = True
ret["cmd"] = cmd
return ret
|
https://github.com/borgbase/vorta/issues/606
|
2020-08-31 20:53:34,066 - vorta.borg.borg_thread - DEBUG - Using VortaSecretStorageKeyring keyring to store passwords.
2020-08-31 20:53:34,066 - asyncio - DEBUG - Using selector: EpollSelector
Traceback (most recent call last):
File "/home/user/.local/lib/python3.8/site-packages/vorta/views/repo_add_dialog.py", line 64, in run
params = BorgInitThread.prepare(self.values)
File "/home/user/.local/lib/python3.8/site-packages/vorta/borg/init.py", line 20, in prepare
ret = super().prepare(profile)
File "/home/user/.local/lib/python3.8/site-packages/vorta/borg/borg_thread.py", line 121, in prepare
ret['password'] = keyring.get_password('vorta-repo', profile.repo.url)
File "/home/user/.local/lib/python3.8/site-packages/vorta/keyring/secretstorage.py", line 30, in get_password
collection = secretstorage.get_default_collection(self.connection)
File "/usr/lib/python3/dist-packages/secretstorage/collection.py", line 155, in get_default_collection
return Collection(bus)
File "/usr/lib/python3/dist-packages/secretstorage/collection.py", line 42, in __init__
self.collection_props_iface.Get(COLLECTION_IFACE, 'Label',
File "/usr/lib/python3/dist-packages/secretstorage/util.py", line 31, in function_out
return function_in(*args, **kwargs)
File "/usr/lib/python3/dist-packages/dbus/proxies.py", line 141, in __call__
return self._connection.call_blocking(self._named_service,
File "/usr/lib/python3/dist-packages/dbus/connection.py", line 652, in call_blocking
reply_message = self.send_message_with_reply_and_block(
dbus.exceptions.DBusException: org.freedesktop.DBus.Error.UnknownObject: No such object path '/org/freedesktop/secrets/aliases/default'
|
dbus.exceptions.DBusException
|
def prepare(cls, params):
# Build fake profile because we don't have it in the DB yet.
profile = FakeProfile(
FakeRepo(
params["repo_url"],
999,
params["extra_borg_arguments"],
params["encryption"],
),
"Init Repo",
params["ssh_key"],
)
ret = super().prepare(profile)
if not ret["ok"]:
return ret
else:
ret["ok"] = False # Set back to false, so we can do our own checks here.
cmd = ["borg", "init", "--info", "--log-json"]
cmd.append(f"--encryption={params['encryption']}")
cmd.append(params["repo_url"])
ret["additional_env"] = {"BORG_RSH": "ssh -oStrictHostKeyChecking=no"}
ret["encryption"] = params["encryption"]
ret["password"] = params["password"]
ret["ok"] = True
ret["cmd"] = cmd
return ret
|
def prepare(cls, params):
# Build fake profile because we don't have it in the DB yet.
profile = FakeProfile(
FakeRepo(params["repo_url"], 999, params["extra_borg_arguments"]),
"Init Repo",
params["ssh_key"],
)
ret = super().prepare(profile)
if not ret["ok"]:
return ret
else:
ret["ok"] = False # Set back to false, so we can do our own checks here.
cmd = ["borg", "init", "--info", "--log-json"]
cmd.append(f"--encryption={params['encryption']}")
cmd.append(params["repo_url"])
ret["additional_env"] = {"BORG_RSH": "ssh -oStrictHostKeyChecking=no"}
ret["encryption"] = params["encryption"]
ret["password"] = params["password"]
ret["ok"] = True
ret["cmd"] = cmd
return ret
|
https://github.com/borgbase/vorta/issues/606
|
2020-08-31 20:53:34,066 - vorta.borg.borg_thread - DEBUG - Using VortaSecretStorageKeyring keyring to store passwords.
2020-08-31 20:53:34,066 - asyncio - DEBUG - Using selector: EpollSelector
Traceback (most recent call last):
File "/home/user/.local/lib/python3.8/site-packages/vorta/views/repo_add_dialog.py", line 64, in run
params = BorgInitThread.prepare(self.values)
File "/home/user/.local/lib/python3.8/site-packages/vorta/borg/init.py", line 20, in prepare
ret = super().prepare(profile)
File "/home/user/.local/lib/python3.8/site-packages/vorta/borg/borg_thread.py", line 121, in prepare
ret['password'] = keyring.get_password('vorta-repo', profile.repo.url)
File "/home/user/.local/lib/python3.8/site-packages/vorta/keyring/secretstorage.py", line 30, in get_password
collection = secretstorage.get_default_collection(self.connection)
File "/usr/lib/python3/dist-packages/secretstorage/collection.py", line 155, in get_default_collection
return Collection(bus)
File "/usr/lib/python3/dist-packages/secretstorage/collection.py", line 42, in __init__
self.collection_props_iface.Get(COLLECTION_IFACE, 'Label',
File "/usr/lib/python3/dist-packages/secretstorage/util.py", line 31, in function_out
return function_in(*args, **kwargs)
File "/usr/lib/python3/dist-packages/dbus/proxies.py", line 141, in __call__
return self._connection.call_blocking(self._named_service,
File "/usr/lib/python3/dist-packages/dbus/connection.py", line 652, in call_blocking
reply_message = self.send_message_with_reply_and_block(
dbus.exceptions.DBusException: org.freedesktop.DBus.Error.UnknownObject: No such object path '/org/freedesktop/secrets/aliases/default'
|
dbus.exceptions.DBusException
|
def set_password(self, service, repo_url, password):
"""
Writes a password to the underlying store.
"""
raise NotImplementedError
|
def set_password(self, service, repo_url, password):
raise NotImplementedError
|
https://github.com/borgbase/vorta/issues/606
|
2020-08-31 20:53:34,066 - vorta.borg.borg_thread - DEBUG - Using VortaSecretStorageKeyring keyring to store passwords.
2020-08-31 20:53:34,066 - asyncio - DEBUG - Using selector: EpollSelector
Traceback (most recent call last):
File "/home/user/.local/lib/python3.8/site-packages/vorta/views/repo_add_dialog.py", line 64, in run
params = BorgInitThread.prepare(self.values)
File "/home/user/.local/lib/python3.8/site-packages/vorta/borg/init.py", line 20, in prepare
ret = super().prepare(profile)
File "/home/user/.local/lib/python3.8/site-packages/vorta/borg/borg_thread.py", line 121, in prepare
ret['password'] = keyring.get_password('vorta-repo', profile.repo.url)
File "/home/user/.local/lib/python3.8/site-packages/vorta/keyring/secretstorage.py", line 30, in get_password
collection = secretstorage.get_default_collection(self.connection)
File "/usr/lib/python3/dist-packages/secretstorage/collection.py", line 155, in get_default_collection
return Collection(bus)
File "/usr/lib/python3/dist-packages/secretstorage/collection.py", line 42, in __init__
self.collection_props_iface.Get(COLLECTION_IFACE, 'Label',
File "/usr/lib/python3/dist-packages/secretstorage/util.py", line 31, in function_out
return function_in(*args, **kwargs)
File "/usr/lib/python3/dist-packages/dbus/proxies.py", line 141, in __call__
return self._connection.call_blocking(self._named_service,
File "/usr/lib/python3/dist-packages/dbus/connection.py", line 652, in call_blocking
reply_message = self.send_message_with_reply_and_block(
dbus.exceptions.DBusException: org.freedesktop.DBus.Error.UnknownObject: No such object path '/org/freedesktop/secrets/aliases/default'
|
dbus.exceptions.DBusException
|
def get_keyring():
"""
Attempts to get secure keyring at runtime if current keyring is insecure.
Once it finds a secure keyring, it wil always use that keyring
"""
global _keyring
if _keyring is None or not _keyring.is_primary:
if sys.platform == "darwin": # Use Keychain on macOS
from .darwin import VortaDarwinKeyring
_keyring = VortaDarwinKeyring()
else: # Try to use DBus and Gnome-Keyring (available on Linux and *BSD)
import secretstorage
from .secretstorage import VortaSecretStorageKeyring
# secretstorage has two different libraries based on version
if parse_version(secretstorage.__version__) >= parse_version("3.0.0"):
from jeepney.wrappers import DBusErrorResponse as DBusException
else:
from dbus.exceptions import DBusException
try:
_keyring = VortaSecretStorageKeyring()
except (
secretstorage.exceptions.SecretStorageException,
DBusException,
): # Try to use KWallet (KDE)
from .kwallet import VortaKWallet5Keyring, KWalletNotAvailableException
try:
_keyring = VortaKWallet5Keyring()
except (
KWalletNotAvailableException
): # Save passwords in DB, if all else fails.
from .db import VortaDBKeyring
_keyring = VortaDBKeyring()
return _keyring
|
def get_keyring():
"""
Attempts to get secure keyring at runtime if current keyring is insecure.
Once it finds a secure keyring, it wil always use that keyring
"""
global _keyring
if _keyring is None or not _keyring.is_primary:
if sys.platform == "darwin": # Use Keychain on macOS
from .darwin import VortaDarwinKeyring
_keyring = VortaDarwinKeyring()
else: # Try to use DBus and Gnome-Keyring (available on Linux and *BSD)
import secretstorage
from .secretstorage import VortaSecretStorageKeyring
try:
_keyring = VortaSecretStorageKeyring()
except (
secretstorage.SecretServiceNotAvailableException
): # Try to use KWallet
from .kwallet import VortaKWallet5Keyring, KWalletNotAvailableException
try:
_keyring = VortaKWallet5Keyring()
except (
KWalletNotAvailableException
): # Save passwords in DB, if all else fails.
from .db import VortaDBKeyring
_keyring = VortaDBKeyring()
return _keyring
|
https://github.com/borgbase/vorta/issues/606
|
2020-08-31 20:53:34,066 - vorta.borg.borg_thread - DEBUG - Using VortaSecretStorageKeyring keyring to store passwords.
2020-08-31 20:53:34,066 - asyncio - DEBUG - Using selector: EpollSelector
Traceback (most recent call last):
File "/home/user/.local/lib/python3.8/site-packages/vorta/views/repo_add_dialog.py", line 64, in run
params = BorgInitThread.prepare(self.values)
File "/home/user/.local/lib/python3.8/site-packages/vorta/borg/init.py", line 20, in prepare
ret = super().prepare(profile)
File "/home/user/.local/lib/python3.8/site-packages/vorta/borg/borg_thread.py", line 121, in prepare
ret['password'] = keyring.get_password('vorta-repo', profile.repo.url)
File "/home/user/.local/lib/python3.8/site-packages/vorta/keyring/secretstorage.py", line 30, in get_password
collection = secretstorage.get_default_collection(self.connection)
File "/usr/lib/python3/dist-packages/secretstorage/collection.py", line 155, in get_default_collection
return Collection(bus)
File "/usr/lib/python3/dist-packages/secretstorage/collection.py", line 42, in __init__
self.collection_props_iface.Get(COLLECTION_IFACE, 'Label',
File "/usr/lib/python3/dist-packages/secretstorage/util.py", line 31, in function_out
return function_in(*args, **kwargs)
File "/usr/lib/python3/dist-packages/dbus/proxies.py", line 141, in __call__
return self._connection.call_blocking(self._named_service,
File "/usr/lib/python3/dist-packages/dbus/connection.py", line 652, in call_blocking
reply_message = self.send_message_with_reply_and_block(
dbus.exceptions.DBusException: org.freedesktop.DBus.Error.UnknownObject: No such object path '/org/freedesktop/secrets/aliases/default'
|
dbus.exceptions.DBusException
|
def _set_keychain(self):
"""
Lazy import to avoid conflict with pytest-xdist.
"""
import objc
from Foundation import NSBundle
Security = NSBundle.bundleWithIdentifier_("com.apple.security")
# https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/ObjCRuntimeGuide/Articles/ocrtTypeEncodings.html
S_functions = [
("SecKeychainGetTypeID", b"I"),
("SecKeychainItemGetTypeID", b"I"),
(
"SecKeychainAddGenericPassword",
b"i^{OpaqueSecKeychainRef=}I*I*I*o^^{OpaqueSecKeychainItemRef}",
),
("SecKeychainOpen", b"i*o^^{OpaqueSecKeychainRef}"),
(
"SecKeychainFindGenericPassword",
b"i@I*I*o^Io^^{OpaquePassBuff}o^^{OpaqueSecKeychainItemRef}",
),
("SecKeychainGetStatus", b"i^{OpaqueSecKeychainRef=}o^I"),
]
objc.loadBundleFunctions(Security, globals(), S_functions)
SecKeychainRef = objc.registerCFSignature(
"SecKeychainRef", b"^{OpaqueSecKeychainRef=}", SecKeychainGetTypeID()
)
SecKeychainItemRef = objc.registerCFSignature(
"SecKeychainItemRef",
b"^{OpaqueSecKeychainItemRef=}",
SecKeychainItemGetTypeID(),
)
PassBuffRef = objc.createOpaquePointerType(
"PassBuffRef", b"^{OpaquePassBuff=}", None
)
# Get the login keychain
result, login_keychain = SecKeychainOpen(b"login.keychain", None)
self.login_keychain = login_keychain
|
def _set_keychain(self):
"""
Lazy import to avoid conflict with pytest-xdist.
"""
import objc
from Foundation import NSBundle
Security = NSBundle.bundleWithIdentifier_("com.apple.security")
S_functions = [
("SecKeychainGetTypeID", b"I"),
("SecKeychainItemGetTypeID", b"I"),
(
"SecKeychainAddGenericPassword",
b"i^{OpaqueSecKeychainRef=}I*I*I*o^^{OpaqueSecKeychainItemRef}",
),
("SecKeychainOpen", b"i*o^^{OpaqueSecKeychainRef}"),
(
"SecKeychainFindGenericPassword",
b"i@I*I*o^Io^^{OpaquePassBuff}o^^{OpaqueSecKeychainItemRef}",
),
]
objc.loadBundleFunctions(Security, globals(), S_functions)
SecKeychainRef = objc.registerCFSignature(
"SecKeychainRef", b"^{OpaqueSecKeychainRef=}", SecKeychainGetTypeID()
)
SecKeychainItemRef = objc.registerCFSignature(
"SecKeychainItemRef",
b"^{OpaqueSecKeychainItemRef=}",
SecKeychainItemGetTypeID(),
)
PassBuffRef = objc.createOpaquePointerType(
"PassBuffRef", b"^{OpaquePassBuff=}", None
)
# Get the login keychain
result, login_keychain = SecKeychainOpen(b"login.keychain", None)
self.login_keychain = login_keychain
|
https://github.com/borgbase/vorta/issues/606
|
2020-08-31 20:53:34,066 - vorta.borg.borg_thread - DEBUG - Using VortaSecretStorageKeyring keyring to store passwords.
2020-08-31 20:53:34,066 - asyncio - DEBUG - Using selector: EpollSelector
Traceback (most recent call last):
File "/home/user/.local/lib/python3.8/site-packages/vorta/views/repo_add_dialog.py", line 64, in run
params = BorgInitThread.prepare(self.values)
File "/home/user/.local/lib/python3.8/site-packages/vorta/borg/init.py", line 20, in prepare
ret = super().prepare(profile)
File "/home/user/.local/lib/python3.8/site-packages/vorta/borg/borg_thread.py", line 121, in prepare
ret['password'] = keyring.get_password('vorta-repo', profile.repo.url)
File "/home/user/.local/lib/python3.8/site-packages/vorta/keyring/secretstorage.py", line 30, in get_password
collection = secretstorage.get_default_collection(self.connection)
File "/usr/lib/python3/dist-packages/secretstorage/collection.py", line 155, in get_default_collection
return Collection(bus)
File "/usr/lib/python3/dist-packages/secretstorage/collection.py", line 42, in __init__
self.collection_props_iface.Get(COLLECTION_IFACE, 'Label',
File "/usr/lib/python3/dist-packages/secretstorage/util.py", line 31, in function_out
return function_in(*args, **kwargs)
File "/usr/lib/python3/dist-packages/dbus/proxies.py", line 141, in __call__
return self._connection.call_blocking(self._named_service,
File "/usr/lib/python3/dist-packages/dbus/connection.py", line 652, in call_blocking
reply_message = self.send_message_with_reply_and_block(
dbus.exceptions.DBusException: org.freedesktop.DBus.Error.UnknownObject: No such object path '/org/freedesktop/secrets/aliases/default'
|
dbus.exceptions.DBusException
|
def set_password(self, service, repo_url, password):
try:
asyncio.set_event_loop(asyncio.new_event_loop())
collection = secretstorage.get_default_collection(self.connection)
attributes = {
"application": "Vorta",
"service": service,
"repo_url": repo_url,
"xdg:schema": "org.freedesktop.Secret.Generic",
}
collection.create_item(repo_url, attributes, password, replace=True)
except secretstorage.exceptions.ItemNotFoundException:
logger.error("SecretStorage writing failed", exc_info=sys.exc_info())
|
def set_password(self, service, repo_url, password):
asyncio.set_event_loop(asyncio.new_event_loop())
collection = secretstorage.get_default_collection(self.connection)
attributes = {
"application": "Vorta",
"service": service,
"repo_url": repo_url,
"xdg:schema": "org.freedesktop.Secret.Generic",
}
collection.create_item(repo_url, attributes, password, replace=True)
|
https://github.com/borgbase/vorta/issues/606
|
2020-08-31 20:53:34,066 - vorta.borg.borg_thread - DEBUG - Using VortaSecretStorageKeyring keyring to store passwords.
2020-08-31 20:53:34,066 - asyncio - DEBUG - Using selector: EpollSelector
Traceback (most recent call last):
File "/home/user/.local/lib/python3.8/site-packages/vorta/views/repo_add_dialog.py", line 64, in run
params = BorgInitThread.prepare(self.values)
File "/home/user/.local/lib/python3.8/site-packages/vorta/borg/init.py", line 20, in prepare
ret = super().prepare(profile)
File "/home/user/.local/lib/python3.8/site-packages/vorta/borg/borg_thread.py", line 121, in prepare
ret['password'] = keyring.get_password('vorta-repo', profile.repo.url)
File "/home/user/.local/lib/python3.8/site-packages/vorta/keyring/secretstorage.py", line 30, in get_password
collection = secretstorage.get_default_collection(self.connection)
File "/usr/lib/python3/dist-packages/secretstorage/collection.py", line 155, in get_default_collection
return Collection(bus)
File "/usr/lib/python3/dist-packages/secretstorage/collection.py", line 42, in __init__
self.collection_props_iface.Get(COLLECTION_IFACE, 'Label',
File "/usr/lib/python3/dist-packages/secretstorage/util.py", line 31, in function_out
return function_in(*args, **kwargs)
File "/usr/lib/python3/dist-packages/dbus/proxies.py", line 141, in __call__
return self._connection.call_blocking(self._named_service,
File "/usr/lib/python3/dist-packages/dbus/connection.py", line 652, in call_blocking
reply_message = self.send_message_with_reply_and_block(
dbus.exceptions.DBusException: org.freedesktop.DBus.Error.UnknownObject: No such object path '/org/freedesktop/secrets/aliases/default'
|
dbus.exceptions.DBusException
|
def get_password(self, service, repo_url):
if self.is_unlocked:
asyncio.set_event_loop(asyncio.new_event_loop())
collection = secretstorage.get_default_collection(self.connection)
attributes = {"application": "Vorta", "service": service, "repo_url": repo_url}
items = list(collection.search_items(attributes))
logger.debug("Found %i passwords matching repo URL.", len(items))
if len(items) > 0:
return items[0].get_secret().decode("utf-8")
return None
|
def get_password(self, service, repo_url):
asyncio.set_event_loop(asyncio.new_event_loop())
collection = secretstorage.get_default_collection(self.connection)
if collection.is_locked():
collection.unlock()
attributes = {"application": "Vorta", "service": service, "repo_url": repo_url}
items = list(collection.search_items(attributes))
logger.debug("Found %i passwords matching repo URL.", len(items))
if len(items) > 0:
return items[0].get_secret().decode("utf-8")
return None
|
https://github.com/borgbase/vorta/issues/606
|
2020-08-31 20:53:34,066 - vorta.borg.borg_thread - DEBUG - Using VortaSecretStorageKeyring keyring to store passwords.
2020-08-31 20:53:34,066 - asyncio - DEBUG - Using selector: EpollSelector
Traceback (most recent call last):
File "/home/user/.local/lib/python3.8/site-packages/vorta/views/repo_add_dialog.py", line 64, in run
params = BorgInitThread.prepare(self.values)
File "/home/user/.local/lib/python3.8/site-packages/vorta/borg/init.py", line 20, in prepare
ret = super().prepare(profile)
File "/home/user/.local/lib/python3.8/site-packages/vorta/borg/borg_thread.py", line 121, in prepare
ret['password'] = keyring.get_password('vorta-repo', profile.repo.url)
File "/home/user/.local/lib/python3.8/site-packages/vorta/keyring/secretstorage.py", line 30, in get_password
collection = secretstorage.get_default_collection(self.connection)
File "/usr/lib/python3/dist-packages/secretstorage/collection.py", line 155, in get_default_collection
return Collection(bus)
File "/usr/lib/python3/dist-packages/secretstorage/collection.py", line 42, in __init__
self.collection_props_iface.Get(COLLECTION_IFACE, 'Label',
File "/usr/lib/python3/dist-packages/secretstorage/util.py", line 31, in function_out
return function_in(*args, **kwargs)
File "/usr/lib/python3/dist-packages/dbus/proxies.py", line 141, in __call__
return self._connection.call_blocking(self._named_service,
File "/usr/lib/python3/dist-packages/dbus/connection.py", line 652, in call_blocking
reply_message = self.send_message_with_reply_and_block(
dbus.exceptions.DBusException: org.freedesktop.DBus.Error.UnknownObject: No such object path '/org/freedesktop/secrets/aliases/default'
|
dbus.exceptions.DBusException
|
def get_keyring(cls):
"""
Attempts to get secure keyring at runtime if current keyring is insecure.
Once it finds a secure keyring, it wil always use that keyring
"""
if cls._keyring is None or not cls._keyring.is_primary:
if sys.platform == "darwin": # Use Keychain on macOS
from .darwin import VortaDarwinKeyring
cls._keyring = VortaDarwinKeyring()
else:
# Try to use KWallet (KDE)
from .kwallet import VortaKWallet5Keyring, KWalletNotAvailableException
try:
cls._keyring = VortaKWallet5Keyring()
except KWalletNotAvailableException:
# Try to use DBus and Gnome-Keyring (available on Linux and *BSD)
# Put this last as gnome keyring is included by default on many distros
import secretstorage
from .secretstorage import VortaSecretStorageKeyring
# secretstorage has two different libraries based on version
if parse_version(secretstorage.__version__) >= parse_version("3.0.0"):
from jeepney.wrappers import DBusErrorResponse as DBusException
else:
from dbus.exceptions import DBusException
try:
cls._keyring = VortaSecretStorageKeyring()
except (secretstorage.exceptions.SecretStorageException, DBusException):
# Save passwords in DB, if all else fails.
from .db import VortaDBKeyring
cls._keyring = VortaDBKeyring()
return cls._keyring
|
def get_keyring(cls):
"""
Attempts to get secure keyring at runtime if current keyring is insecure.
Once it finds a secure keyring, it wil always use that keyring
"""
if cls._keyring is None or not cls._keyring.is_primary:
if sys.platform == "darwin": # Use Keychain on macOS
from .darwin import VortaDarwinKeyring
cls._keyring = VortaDarwinKeyring()
else: # Try to use DBus and Gnome-Keyring (available on Linux and *BSD)
import secretstorage
from .secretstorage import VortaSecretStorageKeyring
# secretstorage has two different libraries based on version
if parse_version(secretstorage.__version__) >= parse_version("3.0.0"):
from jeepney.wrappers import DBusErrorResponse as DBusException
else:
from dbus.exceptions import DBusException
try:
cls._keyring = VortaSecretStorageKeyring()
except (
secretstorage.exceptions.SecretStorageException,
DBusException,
): # Try to use KWallet (KDE)
from .kwallet import VortaKWallet5Keyring, KWalletNotAvailableException
try:
cls._keyring = VortaKWallet5Keyring()
except (
KWalletNotAvailableException
): # Save passwords in DB, if all else fails.
from .db import VortaDBKeyring
cls._keyring = VortaDBKeyring()
return cls._keyring
|
https://github.com/borgbase/vorta/issues/606
|
2020-08-31 20:53:34,066 - vorta.borg.borg_thread - DEBUG - Using VortaSecretStorageKeyring keyring to store passwords.
2020-08-31 20:53:34,066 - asyncio - DEBUG - Using selector: EpollSelector
Traceback (most recent call last):
File "/home/user/.local/lib/python3.8/site-packages/vorta/views/repo_add_dialog.py", line 64, in run
params = BorgInitThread.prepare(self.values)
File "/home/user/.local/lib/python3.8/site-packages/vorta/borg/init.py", line 20, in prepare
ret = super().prepare(profile)
File "/home/user/.local/lib/python3.8/site-packages/vorta/borg/borg_thread.py", line 121, in prepare
ret['password'] = keyring.get_password('vorta-repo', profile.repo.url)
File "/home/user/.local/lib/python3.8/site-packages/vorta/keyring/secretstorage.py", line 30, in get_password
collection = secretstorage.get_default_collection(self.connection)
File "/usr/lib/python3/dist-packages/secretstorage/collection.py", line 155, in get_default_collection
return Collection(bus)
File "/usr/lib/python3/dist-packages/secretstorage/collection.py", line 42, in __init__
self.collection_props_iface.Get(COLLECTION_IFACE, 'Label',
File "/usr/lib/python3/dist-packages/secretstorage/util.py", line 31, in function_out
return function_in(*args, **kwargs)
File "/usr/lib/python3/dist-packages/dbus/proxies.py", line 141, in __call__
return self._connection.call_blocking(self._named_service,
File "/usr/lib/python3/dist-packages/dbus/connection.py", line 652, in call_blocking
reply_message = self.send_message_with_reply_and_block(
dbus.exceptions.DBusException: org.freedesktop.DBus.Error.UnknownObject: No such object path '/org/freedesktop/secrets/aliases/default'
|
dbus.exceptions.DBusException
|
def get_network_status_monitor(cls) -> "NetworkStatusMonitor":
if sys.platform == "darwin":
from .darwin import DarwinNetworkStatus
return DarwinNetworkStatus()
else:
from .network_manager import (
NetworkManagerMonitor,
UnsupportedException,
DBusException,
)
try:
return NetworkManagerMonitor()
except (UnsupportedException, DBusException):
return NullNetworkStatusMonitor()
|
def get_network_status_monitor(cls) -> "NetworkStatusMonitor":
if sys.platform == "darwin":
from .darwin import DarwinNetworkStatus
return DarwinNetworkStatus()
else:
from .network_manager import NetworkManagerMonitor, UnsupportedException
try:
return NetworkManagerMonitor()
except UnsupportedException:
return NullNetworkStatusMonitor()
|
https://github.com/borgbase/vorta/issues/669
|
Traceback (most recent call last):
File "/usr/bin/vorta", line 33, in <module>
sys.exit(load_entry_point('vorta==0.7.1', 'gui_scripts', 'vorta')())
File "/usr/lib/python3.8/site-packages/vorta/__main__.py", line 37, in main
app = VortaApp(sys.argv, single_app=True)
File "/usr/lib/python3.8/site-packages/vorta/application.py", line 56, in __init__
self.open_main_window_action()
File "/usr/lib/python3.8/site-packages/vorta/application.py", line 90, in open_main_window_action
self.main_window = MainWindow(self)
File "/usr/lib/python3.8/site-packages/vorta/views/main_window.py", line 50, in __init__
self.scheduleTab = ScheduleTab(self.scheduleTabSlot)
File "/usr/lib/python3.8/site-packages/vorta/views/schedule_tab.py", line 32, in __init__
self.populate_from_profile()
File "/usr/lib/python3.8/site-packages/vorta/views/schedule_tab.py", line 68, in populate_from_profile
self.init_wifi()
File "/usr/lib/python3.8/site-packages/vorta/views/schedule_tab.py", line 72, in init_wifi
for wifi in get_sorted_wifis(self.profile()):
File "/usr/lib/python3.8/site-packages/vorta/utils.py", line 138, in get_sorted_wifis
system_wifis = get_network_status_monitor().get_known_wifis()
File "/usr/lib/python3.8/site-packages/vorta/utils.py", line 41, in get_network_status_monitor
_network_status_monitor = NetworkStatusMonitor.get_network_status_monitor()
File "/usr/lib/python3.8/site-packages/vorta/network_status/abc.py", line 15, in get_network_status_monitor
return NetworkManagerMonitor()
File "/usr/lib/python3.8/site-packages/vorta/network_status/network_manager.py", line 16, in __init__
self._nm = nm_adapter or NetworkManagerDBusAdapter.get_system_nm_adapter()
File "/usr/lib/python3.8/site-packages/vorta/network_status/network_manager.py", line 110, in get_system_nm_adapter
if not nm_adapter.isValid():
File "/usr/lib/python3.8/site-packages/vorta/network_status/network_manager.py", line 117, in isValid
nm_version = self._get_nm_version()
File "/usr/lib/python3.8/site-packages/vorta/network_status/network_manager.py", line 145, in _get_nm_version
version, _suffindex = QVersionNumber.fromString(read_dbus_property(self._nm, 'Version'))
File "/usr/lib/python3.8/site-packages/vorta/network_status/network_manager.py", line 156, in read_dbus_property
return get_result(msg)
File "/usr/lib/python3.8/site-packages/vorta/network_status/network_manager.py", line 163, in get_result
raise DBusException("DBus call failed: {}".format(msg.arguments()))
vorta.network_status.network_manager.DBusException: DBus call failed: ['Unsupported property']
|
vorta.network_status.network_manager.DBusException
|
def validate(self):
"""Pre-flight check for valid input and borg binary."""
if self.is_remote_repo and not re.match(r".+:.+", self.values["repo_url"]):
self._set_status(
self.tr("Please enter a valid repo URL or select a local path.")
)
return False
if RepoModel.get_or_none(RepoModel.url == self.values["repo_url"]) is not None:
self._set_status(self.tr("This repo has already been added."))
return False
if self.__class__ == AddRepoWindow:
if self.values["encryption"] != "none":
if len(self.values["password"]) < 8:
self._set_status(self.tr("Please use a longer passphrase."))
return False
return True
|
def validate(self):
"""Pre-flight check for valid input and borg binary."""
if self.is_remote_repo and not re.match(r".+:.+", self.values["repo_url"]):
self._set_status(
self.tr("Please enter a valid repo URL or select a local path.")
)
return False
if self.__class__ == AddRepoWindow:
if self.values["encryption"] != "none":
if len(self.values["password"]) < 8:
self._set_status(self.tr("Please use a longer passphrase."))
return False
return True
|
https://github.com/borgbase/vorta/issues/473
|
Traceback (most recent call last):
File "/app/lib/python3.7/site-packages/peewee.py", line 6665, in get
return clone.execute(database)[0]
File "/app/lib/python3.7/site-packages/peewee.py", line 4121, in __getitem__
return self.row_cache[item]
IndexError: list index out of range
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/app/lib/python3.7/site-packages/vorta/application.py", line 80, in open_main_window_action
self.main_window = MainWindow(self)
File "/app/lib/python3.7/site-packages/vorta/views/main_window.py", line 37, in __init__
self.repoTab = RepoTab(self.repoTabSlot)
File "/app/lib/python3.7/site-packages/vorta/views/repo_tab.py", line 59, in __init__
self.init_repo_stats()
File "/app/lib/python3.7/site-packages/vorta/views/repo_tab.py", line 74, in init_repo_stats
repo = self.profile().repo
File "/app/lib/python3.7/site-packages/peewee.py", line 4269, in __get__
return self.get_rel_instance(instance)
File "/app/lib/python3.7/site-packages/peewee.py", line 4260, in get_rel_instance
obj = self.rel_model.get(self.field.rel_field == value)
File "/app/lib/python3.7/site-packages/peewee.py", line 6242, in get
return sq.get()
File "/app/lib/python3.7/site-packages/peewee.py", line 6670, in get
(clone.model, sql, params))
vorta.models.RepoModelDoesNotExist: <Model: RepoModel> instance matching query does not exist:
SQL: SELECT "t1"."id", "t1"."url", "t1"."added_at", "t1"."encryption", "t1"."unique_size", "t1"."unique_csize", "t1"."total_size", "t1"."total_unique_chunks", "t1"."extra_borg_arguments" FROM "repomodel" AS "t1" WHERE ("t1"."id" = ?) LIMIT ? OFFSET ?
Params: [1, 1, 0]
|
IndexError
|
def __init__(self, parent=None):
super().__init__(parent)
self.setupUi(parent)
# Populate dropdowns
self.repoSelector.model().item(0).setEnabled(False)
self.repoSelector.addItem(self.tr("+ Initialize New Repository"), "new")
self.repoSelector.addItem(self.tr("+ Add Existing Repository"), "existing")
self.repoSelector.insertSeparator(3)
self.set_repos()
self.repoSelector.currentIndexChanged.connect(self.repo_select_action)
self.repoRemoveToolbutton.clicked.connect(self.repo_unlink_action)
# note: it is hard to describe these algorithms with attributes like low/medium/high
# compression or speed on a unified scale. this is not 1-dimensional and also depends
# on the input data. so we just tell what we know for sure.
# "auto" is used for some slower / older algorithms to avoid wasting a lot of time
# on uncompressible data.
self.repoCompression.addItem(self.tr("LZ4 (modern, default)"), "lz4")
self.repoCompression.addItem(self.tr("Zstandard Level 3 (modern)"), "zstd,3")
self.repoCompression.addItem(self.tr("Zstandard Level 8 (modern)"), "zstd,8")
# zlib and lzma come from python stdlib and are there (and in borg) since long.
# but maybe not much reason to start with these nowadays, considering zstd supports
# a very wide range of compression levels and has great speed. if speed is more
# important than compression, lz4 is even a little better.
self.repoCompression.addItem(self.tr("ZLIB Level 6 (auto, legacy)"), "auto,zlib,6")
self.repoCompression.addItem(self.tr("LZMA Level 6 (auto, legacy)"), "auto,lzma,6")
self.repoCompression.addItem(self.tr("No Compression"), "none")
self.repoCompression.currentIndexChanged.connect(self.compression_select_action)
self.toggle_available_compression()
self.repoCompression.currentIndexChanged.connect(self.compression_select_action)
self.init_ssh()
self.sshComboBox.currentIndexChanged.connect(self.ssh_select_action)
self.sshKeyToClipboardButton.clicked.connect(self.ssh_copy_to_clipboard_action)
self.init_repo_stats()
self.populate_from_profile()
self.set_icons()
|
def __init__(self, parent=None):
super().__init__(parent)
self.setupUi(parent)
# Populate dropdowns
self.repoSelector.model().item(0).setEnabled(False)
self.repoSelector.addItem(self.tr("+ Initialize New Repository"), "new")
self.repoSelector.addItem(self.tr("+ Add Existing Repository"), "existing")
self.repoSelector.insertSeparator(3)
for repo in RepoModel.select():
self.repoSelector.addItem(repo.url, repo.id)
self.repoSelector.currentIndexChanged.connect(self.repo_select_action)
self.repoRemoveToolbutton.clicked.connect(self.repo_unlink_action)
# note: it is hard to describe these algorithms with attributes like low/medium/high
# compression or speed on a unified scale. this is not 1-dimensional and also depends
# on the input data. so we just tell what we know for sure.
# "auto" is used for some slower / older algorithms to avoid wasting a lot of time
# on uncompressible data.
self.repoCompression.addItem(self.tr("LZ4 (modern, default)"), "lz4")
self.repoCompression.addItem(self.tr("Zstandard Level 3 (modern)"), "zstd,3")
self.repoCompression.addItem(self.tr("Zstandard Level 8 (modern)"), "zstd,8")
# zlib and lzma come from python stdlib and are there (and in borg) since long.
# but maybe not much reason to start with these nowadays, considering zstd supports
# a very wide range of compression levels and has great speed. if speed is more
# important than compression, lz4 is even a little better.
self.repoCompression.addItem(self.tr("ZLIB Level 6 (auto, legacy)"), "auto,zlib,6")
self.repoCompression.addItem(self.tr("LZMA Level 6 (auto, legacy)"), "auto,lzma,6")
self.repoCompression.addItem(self.tr("No Compression"), "none")
self.repoCompression.currentIndexChanged.connect(self.compression_select_action)
self.toggle_available_compression()
self.repoCompression.currentIndexChanged.connect(self.compression_select_action)
self.init_ssh()
self.sshComboBox.currentIndexChanged.connect(self.ssh_select_action)
self.sshKeyToClipboardButton.clicked.connect(self.ssh_copy_to_clipboard_action)
self.init_repo_stats()
self.populate_from_profile()
self.set_icons()
|
https://github.com/borgbase/vorta/issues/473
|
Traceback (most recent call last):
File "/app/lib/python3.7/site-packages/peewee.py", line 6665, in get
return clone.execute(database)[0]
File "/app/lib/python3.7/site-packages/peewee.py", line 4121, in __getitem__
return self.row_cache[item]
IndexError: list index out of range
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/app/lib/python3.7/site-packages/vorta/application.py", line 80, in open_main_window_action
self.main_window = MainWindow(self)
File "/app/lib/python3.7/site-packages/vorta/views/main_window.py", line 37, in __init__
self.repoTab = RepoTab(self.repoTabSlot)
File "/app/lib/python3.7/site-packages/vorta/views/repo_tab.py", line 59, in __init__
self.init_repo_stats()
File "/app/lib/python3.7/site-packages/vorta/views/repo_tab.py", line 74, in init_repo_stats
repo = self.profile().repo
File "/app/lib/python3.7/site-packages/peewee.py", line 4269, in __get__
return self.get_rel_instance(instance)
File "/app/lib/python3.7/site-packages/peewee.py", line 4260, in get_rel_instance
obj = self.rel_model.get(self.field.rel_field == value)
File "/app/lib/python3.7/site-packages/peewee.py", line 6242, in get
return sq.get()
File "/app/lib/python3.7/site-packages/peewee.py", line 6670, in get
(clone.model, sql, params))
vorta.models.RepoModelDoesNotExist: <Model: RepoModel> instance matching query does not exist:
SQL: SELECT "t1"."id", "t1"."url", "t1"."added_at", "t1"."encryption", "t1"."unique_size", "t1"."unique_csize", "t1"."total_size", "t1"."total_unique_chunks", "t1"."extra_borg_arguments" FROM "repomodel" AS "t1" WHERE ("t1"."id" = ?) LIMIT ? OFFSET ?
Params: [1, 1, 0]
|
IndexError
|
def process_new_repo(self, result):
if result["returncode"] == 0:
new_repo = RepoModel.get(url=result["params"]["repo_url"])
profile = self.profile()
profile.repo = new_repo.id
profile.save()
self.set_repos()
self.repoSelector.setCurrentIndex(self.repoSelector.count() - 1)
self.repo_added.emit()
self.init_repo_stats()
|
def process_new_repo(self, result):
if result["returncode"] == 0:
new_repo = RepoModel.get(url=result["params"]["repo_url"])
profile = self.profile()
profile.repo = new_repo.id
profile.save()
self.repoSelector.addItem(new_repo.url, new_repo.id)
self.repoSelector.setCurrentIndex(self.repoSelector.count() - 1)
self.repo_added.emit()
self.init_repo_stats()
|
https://github.com/borgbase/vorta/issues/473
|
Traceback (most recent call last):
File "/app/lib/python3.7/site-packages/peewee.py", line 6665, in get
return clone.execute(database)[0]
File "/app/lib/python3.7/site-packages/peewee.py", line 4121, in __getitem__
return self.row_cache[item]
IndexError: list index out of range
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/app/lib/python3.7/site-packages/vorta/application.py", line 80, in open_main_window_action
self.main_window = MainWindow(self)
File "/app/lib/python3.7/site-packages/vorta/views/main_window.py", line 37, in __init__
self.repoTab = RepoTab(self.repoTabSlot)
File "/app/lib/python3.7/site-packages/vorta/views/repo_tab.py", line 59, in __init__
self.init_repo_stats()
File "/app/lib/python3.7/site-packages/vorta/views/repo_tab.py", line 74, in init_repo_stats
repo = self.profile().repo
File "/app/lib/python3.7/site-packages/peewee.py", line 4269, in __get__
return self.get_rel_instance(instance)
File "/app/lib/python3.7/site-packages/peewee.py", line 4260, in get_rel_instance
obj = self.rel_model.get(self.field.rel_field == value)
File "/app/lib/python3.7/site-packages/peewee.py", line 6242, in get
return sq.get()
File "/app/lib/python3.7/site-packages/peewee.py", line 6670, in get
(clone.model, sql, params))
vorta.models.RepoModelDoesNotExist: <Model: RepoModel> instance matching query does not exist:
SQL: SELECT "t1"."id", "t1"."url", "t1"."added_at", "t1"."encryption", "t1"."unique_size", "t1"."unique_csize", "t1"."total_size", "t1"."total_unique_chunks", "t1"."extra_borg_arguments" FROM "repomodel" AS "t1" WHERE ("t1"."id" = ?) LIMIT ? OFFSET ?
Params: [1, 1, 0]
|
IndexError
|
def from_public_key_recovery(
klass, signature, data, curve, hashfunc=sha1, sigdecode=sigdecode_string
):
# Given a signature and corresponding message this function
# returns a list of verifying keys for this signature and message
digest = hashfunc(data).digest()
return klass.from_public_key_recovery_with_digest(
signature, digest, curve, hashfunc=sha1, sigdecode=sigdecode
)
|
def from_public_key_recovery(
klass, signature, data, curve, hashfunc=sha1, sigdecode=sigdecode_string
):
# Given a signature and corresponding message this function
# returns a list of verifying keys for this signature and message
digest = hashfunc(data).digest()
return klass.from_public_key_recovery_with_digest(
signature, digest, curve, hashfunc=sha1, sigdecode=sigdecode_string
)
|
https://github.com/tlsfuzzer/python-ecdsa/issues/108
|
correct 88546510979682037774707173221481493851486333744139811890585270440885638210651 25114176564622922097833533925221099216470038098832442934481636541806701930216
88546510979682037774707173221481493851486333744139811890585270440885638210651 25114176564622922097833533925221099216470038098832442934481636541806701930216
Traceback (most recent call last):
File "C:\Users\hasee\Desktop\test2.py", line 85, in <module>
signature=signature, data=data, curve=curve, sigdecode=ecdsa.util.sigdecode_der)
File "D:\anaconda3\envs\py37\lib\site-packages\ecdsa\keys.py", line 89, in from_public_key_recovery
return klass.from_public_key_recovery_with_digest(signature, digest, curve, hashfunc=sha1, sigdecode=sigdecode_string)
File "D:\anaconda3\envs\py37\lib\site-packages\ecdsa\keys.py", line 97, in from_public_key_recovery_with_digest
r, s = sigdecode(signature, generator.order())
File "D:\anaconda3\envs\py37\lib\site-packages\ecdsa\util.py", line 238, in sigdecode_string
assert len(signature) == 2 * l, (len(signature), 2 * l)
AssertionError: (71, 64)
|
AssertionError
|
def __lt__(self, a):
if isinstance(a, visidata.Path):
return self._path.__lt__(a._path)
return self._path.__lt__(a)
|
def __lt__(self, a):
return self._path.__lt__(a)
|
https://github.com/saulpw/visidata/issues/897
|
Traceback (most recent call last):
File "/usr/lib/python3.9/site-packages/visidata/basesheet.py", line 136, in execCommand
exec(code, vdglobals, LazyChainMap(vd, self))
File "sort-desc", line 1, in <module>
File "/usr/lib/python3.9/site-packages/visidata/sort.py", line 28, in orderBy
sheet.sort()
File "/usr/lib/python3.9/site-packages/visidata/sheets.py", line 983, in sort
self.rows[1:] = sorted(self.rows[1:], key=self.sortkey)
File "/usr/lib/python3.9/site-packages/visidata/sort.py", line 38, in __lt__
return other.obj < self.obj
TypeError: '<' not supported between instances of 'Path' and 'Path'
|
TypeError
|
def vd_cli():
vd.status(__version_info__)
rc = -1
try:
rc = main_vd()
except BrokenPipeError:
os.dup2(
os.open(os.devnull, os.O_WRONLY), sys.stdout.fileno()
) # handle broken pipe gracefully
except visidata.ExpectedException as e:
print("Error: " + str(e))
except FileNotFoundError as e:
print(e)
if options.debug:
raise
sys.stderr.flush()
sys.stdout.flush()
os._exit(rc) # cleanup can be expensive with large datasets
|
def vd_cli():
vd.status(__version_info__)
rc = -1
try:
rc = main_vd()
except visidata.ExpectedException as e:
print("Error: " + str(e))
except FileNotFoundError as e:
print(e)
if options.debug:
raise
sys.stderr.flush()
sys.stdout.flush()
os._exit(rc) # cleanup can be expensive with large datasets
|
https://github.com/saulpw/visidata/issues/851
|
seq 10000 | awk 'BEGIN{print "x,y"} {print $1","2*$1}' | vd -f csv -b - | head
opening - as csv
saving 1 sheets to - as tsv
x y
1 2
2 4
3 6
4 8
5 10
6 12
7 14
8 16
9 18
Traceback (most recent call last):
File "/home/rob/envs/base/bin/vd", line 6, in <module>
visidata.main.vd_cli()
File "/home/rob/envs/base/lib/python3.8/site-packages/visidata/main.py", line 299, in vd_cli
rc = main_vd()
File "/home/rob/envs/base/lib/python3.8/site-packages/visidata/main.py", line 284, in main_vd
saveSheets(outpath, vd.sheets[0], confirm_overwrite=False)
File "/home/rob/envs/base/lib/python3.8/site-packages/visidata/vdobj.py", line 37, in _vdfunc
return func(visidata.vd, *args, **kwargs)
File "/home/rob/envs/base/lib/python3.8/site-packages/visidata/save.py", line 105, in saveSheets
return vd.execAsync(savefunc, givenpath, *vsheets)
File "/home/rob/envs/base/lib/python3.8/site-packages/visidata/main.py", line 198, in <lambda>
vd.execAsync = lambda func, *args, **kwargs: func(*args, **kwargs) # disable async
File "/home/rob/envs/base/lib/python3.8/site-packages/visidata/loaders/tsv.py", line 73, in save_tsv
fp.write(unitsep.join(dispvals.values()))
BrokenPipeError: [Errno 32] Broken pipe
|
BrokenPipeError
|
def setMacro(ks, vs):
vd.macrobindings[ks] = vs
if vd.isLongname(ks):
BaseSheet.addCommand("", ks, "runMacro(vd.macrobindings[longname])")
else:
BaseSheet.addCommand(ks, vs.name, "runMacro(vd.macrobindings[keystrokes])")
|
def setMacro(ks, vs):
vd.macrobindings[ks] = vs
BaseSheet.addCommand(ks, vs.name, "runMacro(vd.macrobindings[keystrokes])")
|
https://github.com/saulpw/visidata/issues/787
|
Traceback (most recent call last):
File "/usr/lib/python3.9/site-packages/visidata/basesheet.py", line 136, in execCommand
exec(code, vdglobals, LazyChainMap(vd, self))
File "macro-record", line 1, in <module>
File "/usr/lib/python3.9/site-packages/visidata/macros.py", line 52, in startMacro
vd.cmdlog.saveMacro(vd.macroMode.rows, ks)
File "/usr/lib/python3.9/site-packages/visidata/macros.py", line 37, in saveMacro
append_tsv_row(vd.macrosheet, (ks, macropath))
File "/usr/lib/python3.9/site-packages/visidata/loaders/tsv.py", line 81, in append_tsv_row
if not vs.source.exists():
AttributeError: 'NoneType' object has no attribute 'exists'
|
AttributeError
|
def macrosheet(vd):
macrospath = Path(os.path.join(options.visidata_dir, "macros.tsv"))
macrosheet = vd.loadInternalSheet(
TsvSheet,
macrospath,
columns=(ColumnItem("command", 0), ColumnItem("filename", 1)),
) or vd.error("error loading macros")
real_macrosheet = IndexSheet("user_macros", rows=[], source=macrosheet)
for ks, fn in macrosheet.rows:
vs = vd.loadInternalSheet(CommandLog, Path(fn))
vd.status(f"setting {ks}")
setMacro(ks, vs)
real_macrosheet.addRow(vs)
return real_macrosheet
|
def macrosheet(vd):
macrospath = Path(os.path.join(options.visidata_dir, "macros.tsv"))
macrosheet = vd.loadInternalSheet(
TsvSheet,
macrospath,
columns=(ColumnItem("command", 0), ColumnItem("filename", 1)),
) or vd.error("error loading macros")
real_macrosheet = IndexSheet("user_macros", rows=[])
for ks, fn in macrosheet.rows:
vs = vd.loadInternalSheet(CommandLog, Path(fn))
vd.status(f"setting {ks}")
setMacro(ks, vs)
real_macrosheet.addRow(vs)
return real_macrosheet
|
https://github.com/saulpw/visidata/issues/787
|
Traceback (most recent call last):
File "/usr/lib/python3.9/site-packages/visidata/basesheet.py", line 136, in execCommand
exec(code, vdglobals, LazyChainMap(vd, self))
File "macro-record", line 1, in <module>
File "/usr/lib/python3.9/site-packages/visidata/macros.py", line 52, in startMacro
vd.cmdlog.saveMacro(vd.macroMode.rows, ks)
File "/usr/lib/python3.9/site-packages/visidata/macros.py", line 37, in saveMacro
append_tsv_row(vd.macrosheet, (ks, macropath))
File "/usr/lib/python3.9/site-packages/visidata/loaders/tsv.py", line 81, in append_tsv_row
if not vs.source.exists():
AttributeError: 'NoneType' object has no attribute 'exists'
|
AttributeError
|
def saveMacro(self, rows, ks):
vs = copy(self)
vs.rows = rows
macropath = Path(fnSuffix(options.visidata_dir + "macro"))
vd.save_vd(macropath, vs)
setMacro(ks, vs)
append_tsv_row(vd.macrosheet.source, (ks, macropath))
|
def saveMacro(self, rows, ks):
vs = copy(self)
vs.rows = rows
macropath = Path(fnSuffix(options.visidata_dir + "macro"))
vd.save_vd(macropath, vs)
setMacro(ks, vs)
append_tsv_row(vd.macrosheet, (ks, macropath))
|
https://github.com/saulpw/visidata/issues/787
|
Traceback (most recent call last):
File "/usr/lib/python3.9/site-packages/visidata/basesheet.py", line 136, in execCommand
exec(code, vdglobals, LazyChainMap(vd, self))
File "macro-record", line 1, in <module>
File "/usr/lib/python3.9/site-packages/visidata/macros.py", line 52, in startMacro
vd.cmdlog.saveMacro(vd.macroMode.rows, ks)
File "/usr/lib/python3.9/site-packages/visidata/macros.py", line 37, in saveMacro
append_tsv_row(vd.macrosheet, (ks, macropath))
File "/usr/lib/python3.9/site-packages/visidata/loaders/tsv.py", line 81, in append_tsv_row
if not vs.source.exists():
AttributeError: 'NoneType' object has no attribute 'exists'
|
AttributeError
|
def afterExecSheet(cmdlog, sheet, escaped, err):
if (
vd.macroMode
and (vd.activeCommand is not None)
and (vd.activeCommand is not UNLOADED)
):
cmd = copy(vd.activeCommand)
cmd.row = cmd.col = cmd.sheet = ""
vd.macroMode.addRow(cmd)
# the following needs to happen at the end, bc
# once cmdlog.afterExecSheet.__wrapped__ runs, vd.activeCommand resets to None
cmdlog.afterExecSheet.__wrapped__(cmdlog, sheet, escaped, err)
|
def afterExecSheet(cmdlog, sheet, escaped, err):
cmdlog.afterExecSheet.__wrapped__(cmdlog, sheet, escaped, err)
if (
vd.macroMode
and (vd.activeCommand is not None)
and (vd.activeCommand is not UNLOADED)
):
cmd = copy(vd.activeCommand)
cmd.row = cmd.col = cmd.sheet = ""
vd.macroMode.addRow(cmd)
|
https://github.com/saulpw/visidata/issues/787
|
Traceback (most recent call last):
File "/usr/lib/python3.9/site-packages/visidata/basesheet.py", line 136, in execCommand
exec(code, vdglobals, LazyChainMap(vd, self))
File "macro-record", line 1, in <module>
File "/usr/lib/python3.9/site-packages/visidata/macros.py", line 52, in startMacro
vd.cmdlog.saveMacro(vd.macroMode.rows, ks)
File "/usr/lib/python3.9/site-packages/visidata/macros.py", line 37, in saveMacro
append_tsv_row(vd.macrosheet, (ks, macropath))
File "/usr/lib/python3.9/site-packages/visidata/loaders/tsv.py", line 81, in append_tsv_row
if not vs.source.exists():
AttributeError: 'NoneType' object has no attribute 'exists'
|
AttributeError
|
def reload(self):
import pandas as pd
if isinstance(self.source, pd.DataFrame):
df = self.source
elif isinstance(self.source, Path):
filetype = getattr(self, "filetype", self.source.ext)
if filetype == "tsv":
readfunc = self.read_tsv
elif filetype == "jsonl":
readfunc = partial(pd.read_json, lines=True)
else:
readfunc = getattr(pd, "read_" + filetype) or vd.error(
"no pandas.read_" + filetype
)
df = readfunc(str(self.source), **options.getall("pandas_" + filetype + "_"))
else:
try:
df = pd.DataFrame(self.source)
except ValueError as err:
vd.fail("error building pandas DataFrame from source data: %s" % err)
# reset the index here
if type(df.index) is not pd.RangeIndex:
df = df.reset_index()
self.columns = []
for col in (c for c in df.columns if not c.startswith("__vd_")):
self.addColumn(
Column(
col,
type=self.dtype_to_type(df[col]),
getter=self.getValue,
setter=self.setValue,
)
)
if self.columns[0].name == "index": # if the df contains an index column
self.column("index").hide()
self.rows = DataFrameAdapter(df)
self._selectedMask = pd.Series(False, index=df.index)
if df.index.nunique() != df.shape[0]:
vd.warning(
"Non-unique index, row selection API may not work or may be incorrect"
)
|
def reload(self):
import pandas as pd
if isinstance(self.source, pd.DataFrame):
df = self.source
elif isinstance(self.source, Path):
filetype = getattr(self, "filetype", self.source.ext)
if filetype == "tsv":
readfunc = self.read_tsv
elif filetype == "jsonl":
readfunc = partial(pd.read_json, lines=True)
else:
readfunc = getattr(pd, "read_" + filetype) or vd.error(
"no pandas.read_" + filetype
)
df = readfunc(str(self.source), **options.getall("pandas_" + filetype + "_"))
# reset the index here
if type(df.index) is not pd.RangeIndex:
df = df.reset_index()
self.columns = []
for col in (c for c in df.columns if not c.startswith("__vd_")):
self.addColumn(
Column(
col,
type=self.dtype_to_type(df[col]),
getter=self.getValue,
setter=self.setValue,
)
)
if self.columns[0].name == "index": # if the df contains an index column
self.column("index").hide()
self.rows = DataFrameAdapter(df)
self._selectedMask = pd.Series(False, index=df.index)
if df.index.nunique() != df.shape[0]:
vd.warning(
"Non-unique index, row selection API may not work or may be incorrect"
)
|
https://github.com/saulpw/visidata/issues/798
|
In [3]: import visidata
In [4]: visidata.view_pandas(None)
---------------------------------------------------------------------------
UnboundLocalError Traceback (most recent call last)
<ipython-input-4-5d0ae9b435d5> in <module>
----> 1 visidata.view_pandas(None)
~/opt/anaconda3/lib/python3.7/site-packages/visidata/loaders/_pandas.py in view_pandas(df)
318
319 def view_pandas(df):
--> 320 run(PandasSheet('', source=df))
321
322
~/opt/anaconda3/lib/python3.7/site-packages/visidata/mainloop.py in run(*sheetlist)
223 curses.use_env(True)
224
--> 225 ret = wrapper(cursesMain, sheetlist)
226
227 if ret:
~/opt/anaconda3/lib/python3.7/site-packages/visidata/mainloop.py in wrapper(f, *args)
213
214 def wrapper(f, *args):
--> 215 return curses.wrapper(setupcolors, f, *args)
216
217 def run(*sheetlist):
~/opt/anaconda3/lib/python3.7/curses/__init__.py in wrapper(*args, **kwds)
100 pass
101
--> 102 return func(stdscr, *args, **kwds)
103 finally:
104 # Set everything back to normal
~/opt/anaconda3/lib/python3.7/site-packages/visidata/mainloop.py in setupcolors(stdscr, f, *args)
210 curses.mouseEvents[getattr(curses, k)] = k
211
--> 212 return f(stdscr, *args)
213
214 def wrapper(f, *args):
~/opt/anaconda3/lib/python3.7/site-packages/visidata/mainloop.py in cursesMain(_scr, sheetlist)
234
235 for vs in sheetlist:
--> 236 vd.push(vs)
237
238 vd.status('Ctrl+H opens help')
~/opt/anaconda3/lib/python3.7/site-packages/visidata/sheets.py in push(vd, vs)
980 vd.allSheets.append(vs)
981
--> 982 vs.ensureLoaded()
983
984
~/opt/anaconda3/lib/python3.7/site-packages/visidata/basesheet.py in ensureLoaded(self)
187 if self.rows is UNLOADED:
188 self.rows = [] # prevent auto-reload from running twice
--> 189 return self.reload() # likely launches new thread
190
191 def reload(self):
~/opt/anaconda3/lib/python3.7/site-packages/visidata/loaders/_pandas.py in reload(self)
118
119 # reset the index here
--> 120 if type(df.index) is not pd.RangeIndex:
121 df = df.reset_index()
122
UnboundLocalError: local variable 'df' referenced before assignment
|
UnboundLocalError
|
def iterload(self):
import openpyxl
self.workbook = openpyxl.load_workbook(
str(self.source), data_only=True, read_only=True
)
for sheetname in self.workbook.sheetnames:
src = self.workbook[sheetname]
vs = XlsxSheet(self.name, sheetname, source=src)
if isinstance(src, openpyxl.Workbook):
vs.reload()
yield vs
|
def iterload(self):
import openpyxl
self.workbook = openpyxl.load_workbook(
str(self.source), data_only=True, read_only=True
)
for sheetname in self.workbook.sheetnames:
vs = XlsxSheet(self.name, sheetname, source=self.workbook[sheetname])
vs.reload()
yield vs
|
https://github.com/saulpw/visidata/issues/797
|
opening _20112020100242.xlsx as xlsx
Traceback (most recent call last):
File "/home/aborruso/.local/bin/vd", line 6, in <module>
visidata.main.vd_cli()
File "/home/aborruso/.local/lib/python3.8/site-packages/visidata/main.py", line 298, in vd_cli
rc = main_vd()
File "/home/aborruso/.local/lib/python3.8/site-packages/visidata/main.py", line 228, in main_vd
vd.push(sources[0])
File "/home/aborruso/.local/lib/python3.8/site-packages/visidata/sheets.py", line 982, in push
vs.ensureLoaded()
File "/home/aborruso/.local/lib/python3.8/site-packages/visidata/basesheet.py", line 189, in ensureLoaded
return self.reload() # likely launches new thread
File "/home/aborruso/.local/lib/python3.8/site-packages/visidata/vdobj.py", line 20, in _execAsync
return visidata.vd.execAsync(func, *args, **kwargs)
File "/home/aborruso/.local/lib/python3.8/site-packages/visidata/main.py", line 198, in <lambda>
vd.execAsync = lambda func, *args, **kwargs: func(*args, **kwargs) # disable async
File "/home/aborruso/.local/lib/python3.8/site-packages/visidata/sheets.py", line 269, in reload
for r in self.iterload():
File "/home/aborruso/.local/lib/python3.8/site-packages/visidata/loaders/xlsx.py", line 26, in iterload
vs.reload()
File "/home/aborruso/.local/lib/python3.8/site-packages/visidata/vdobj.py", line 20, in _execAsync
return visidata.vd.execAsync(func, *args, **kwargs)
File "/home/aborruso/.local/lib/python3.8/site-packages/visidata/main.py", line 198, in <lambda>
vd.execAsync = lambda func, *args, **kwargs: func(*args, **kwargs) # disable async
File "/home/aborruso/.local/lib/python3.8/site-packages/visidata/sheets.py", line 884, in reload
self.setCols(list(self.optlines(itsource, 'header')))
File "/home/aborruso/.local/lib/python3.8/site-packages/visidata/sheets.py", line 870, in optlines
yield next(it)
File "/home/aborruso/.local/lib/python3.8/site-packages/visidata/loaders/xlsx.py", line 33, in iterload
for row in Progress(worksheet.iter_rows(), total=worksheet.max_row or 0):
AttributeError: 'Chartsheet' object has no attribute 'iter_rows'
|
AttributeError
|
def __new__(cls, v=0):
if isinstance(v, (vlen, int, float)):
return super(vlen, cls).__new__(cls, v)
else:
return super(vlen, cls).__new__(cls, len(v))
|
def __new__(cls, v):
if isinstance(v, (vlen, int, float)):
return super(vlen, cls).__new__(cls, v)
else:
return super(vlen, cls).__new__(cls, len(v))
|
https://github.com/saulpw/visidata/issues/690
|
Traceback (most recent call last):
File "/usr/lib/python3.8/site-packages/visidata/threads.py", line 207, in _toplevelTryFunc
t.status = func(*args, **kwargs)
File "/usr/lib/python3.8/site-packages/visidata/pivot.py", line 203, in groupRows
numericGroupRows = {formatRange(numericCols[0], numRange): PivotGroupRow(discreteKeys, numRange, [], {}) for numRange in numericBins}
File "/usr/lib/python3.8/site-packages/visidata/pivot.py", line 203, in <dictcomp>
numericGroupRows = {formatRange(numericCols[0], numRange): PivotGroupRow(discreteKeys, numRange, [], {}) for numRange in numericBins}
File "/usr/lib/python3.8/site-packages/visidata/pivot.py", line 25, in formatRange
nankey = makeErrorKey(col)
File "/usr/lib/python3.8/site-packages/visidata/pivot.py", line 21, in makeErrorKey
return col.type()
TypeError: __new__() missing 1 required positional argument: 'v'
|
TypeError
|
def setCols(self, headerrows):
self.columns = []
for i, colnamelines in enumerate(itertools.zip_longest(*headerrows, fillvalue="")):
colnamelines = ["" if c is None else c for c in colnamelines]
self.addColumn(ColumnItem("".join(colnamelines), i))
self._rowtype = namedlist("tsvobj", [(c.name or "_") for c in self.columns])
|
def setCols(self, headerrows):
self.columns = []
for i, colnamelines in enumerate(itertools.zip_longest(*headerrows, fillvalue="")):
self.addColumn(ColumnItem("".join(colnamelines), i))
self._rowtype = namedlist("tsvobj", [(c.name or "_") for c in self.columns])
|
https://github.com/saulpw/visidata/issues/680
|
Traceback (most recent call last):
File "[...]/visidata/threads.py", line 207, in _toplevelTryFunc
t.status = func(*args, **kwargs)
File "[...]/visidata/sheets.py", line 878, in reload
self.setCols(list(self.optlines(itsource, 'header')))
File "[...]/visidata/sheets.py", line 845, in setCols
self.addColumn(ColumnItem(''.join(colnamelines), i))
TypeError: sequence item 0: expected str instance, NoneType found
|
TypeError
|
def beforeExecHook(self, sheet, cmd, args, keystrokes):
if vd.activeCommand:
self.afterExecSheet(sheet, False, "")
colname, rowname, sheetname = "", "", None
if sheet and not cmd.longname.startswith("open-"):
sheetname = sheet
contains = lambda s, *substrs: any((a in s) for a in substrs)
if (
contains(
cmd.execstr,
"cursorTypedValue",
"cursorDisplay",
"cursorValue",
"cursorCell",
"cursorRow",
)
and sheet.nRows > 0
):
k = sheet.rowkey(sheet.cursorRow)
rowname = keystr(k) if k else sheet.cursorRowIndex
if contains(
cmd.execstr,
"cursorTypedValue",
"cursorDisplay",
"cursorValue",
"cursorCell",
"cursorCol",
"cursorVisibleCol",
):
colname = sheet.cursorCol.name or sheet.visibleCols.index(sheet.cursorCol)
if contains(cmd.execstr, "plotterCursorBox"):
assert not colname and not rowname
bb = sheet.cursorBox
colname = "%s %s" % (sheet.formatX(bb.xmin), sheet.formatX(bb.xmax))
rowname = "%s %s" % (sheet.formatY(bb.ymin), sheet.formatY(bb.ymax))
elif contains(cmd.execstr, "plotterVisibleBox"):
assert not colname and not rowname
bb = sheet.visibleBox
colname = "%s %s" % (sheet.formatX(bb.xmin), sheet.formatX(bb.xmax))
rowname = "%s %s" % (sheet.formatY(bb.ymin), sheet.formatY(bb.ymax))
comment = vd.currentReplayRow.comment if vd.currentReplayRow else cmd.helpstr
vd.activeCommand = self.newRow(
sheet=sheetname,
col=str(colname),
row=str(rowname),
keystrokes=keystrokes,
input=args,
longname=cmd.longname,
comment=comment,
undofuncs=[],
)
|
def beforeExecHook(self, sheet, cmd, args, keystrokes):
if vd.activeCommand:
self.afterExecSheet(sheet, False, "")
colname, rowname, sheetname = "", "", None
if sheet and not cmd.longname.startswith("open-"):
sheetname = sheet
contains = lambda s, *substrs: any((a in s) for a in substrs)
if (
contains(
cmd.execstr,
"cursorTypedValue",
"cursorDisplay",
"cursorValue",
"cursorCell",
"cursorRow",
)
and sheet.nRows > 0
):
k = sheet.rowkey(sheet.cursorRow)
rowname = keystr(k) if k else sheet.cursorRowIndex
if contains(
cmd.execstr,
"cursorTypedValue",
"cursorDisplay",
"cursorValue",
"cursorCell",
"cursorCol",
"cursorVisibleCol",
):
colname = sheet.cursorCol.name or sheet.visibleCols.index(sheet.cursorCol)
comment = vd.currentReplayRow.comment if vd.currentReplayRow else cmd.helpstr
vd.activeCommand = self.newRow(
sheet=sheetname,
col=str(colname),
row=str(rowname),
keystrokes=keystrokes,
input=args,
longname=cmd.longname,
comment=comment,
undofuncs=[],
)
|
https://github.com/saulpw/visidata/issues/637
|
Traceback (most recent call last):
File "/Users/Documents/pyv/py3/lib/python3.7/site-packages/visidata/basesheet.py", line 127, in execCommand
exec(code, vdglobals, LazyChainMap(vd, self))
File "release-mouse", line 1, in <module>
import math
NameError: name 'mouseX' is not defined
|
NameError
|
def add_y_axis_label(self, frac):
txt = self.formatY(self.visibleBox.ymin + frac * self.visibleBox.h)
# plot y-axis labels on the far left of the canvas, but within the plotview height-wise
attr = colors.color_graph_axis
self.plotlabel(
0, self.plotviewBox.ymin + (1.0 - frac) * self.plotviewBox.h, txt, attr
)
|
def add_y_axis_label(self, frac):
amt = self.visibleBox.ymin + frac * self.visibleBox.h
srccol = self.ycols[0]
txt = srccol.format(srccol.type(amt))
# plot y-axis labels on the far left of the canvas, but within the plotview height-wise
attr = colors.color_graph_axis
self.plotlabel(
0, self.plotviewBox.ymin + (1.0 - frac) * self.plotviewBox.h, txt, attr
)
|
https://github.com/saulpw/visidata/issues/637
|
Traceback (most recent call last):
File "/Users/Documents/pyv/py3/lib/python3.7/site-packages/visidata/basesheet.py", line 127, in execCommand
exec(code, vdglobals, LazyChainMap(vd, self))
File "release-mouse", line 1, in <module>
import math
NameError: name 'mouseX' is not defined
|
NameError
|
def add_x_axis_label(self, frac):
txt = self.formatX(self.visibleBox.xmin + frac * self.visibleBox.w)
# plot x-axis labels below the plotviewBox.ymax, but within the plotview width-wise
attr = colors.color_graph_axis
xmin = self.plotviewBox.xmin + frac * self.plotviewBox.w
if frac == 1.0:
# shift rightmost label to be readable
xmin -= max(len(txt) * 2 - self.rightMarginPixels + 1, 0)
self.plotlabel(xmin, self.plotviewBox.ymax + 4, txt, attr)
|
def add_x_axis_label(self, frac):
amt = self.visibleBox.xmin + frac * self.visibleBox.w
txt = ",".join(
xcol.format(xcol.type(amt)) for xcol in self.xcols if isNumeric(xcol)
)
# plot x-axis labels below the plotviewBox.ymax, but within the plotview width-wise
attr = colors.color_graph_axis
xmin = self.plotviewBox.xmin + frac * self.plotviewBox.w
if frac == 1.0:
# shift rightmost label to be readable
xmin -= max(len(txt) * 2 - self.rightMarginPixels + 1, 0)
self.plotlabel(xmin, self.plotviewBox.ymax + 4, txt, attr)
|
https://github.com/saulpw/visidata/issues/637
|
Traceback (most recent call last):
File "/Users/Documents/pyv/py3/lib/python3.7/site-packages/visidata/basesheet.py", line 127, in execCommand
exec(code, vdglobals, LazyChainMap(vd, self))
File "release-mouse", line 1, in <module>
import math
NameError: name 'mouseX' is not defined
|
NameError
|
def set_y(sheet, s):
ymin, ymax = map(float, map(sheet.parseY, s.split()))
sheet.zoomTo(BoundingBox(sheet.visibleBox.xmin, ymin, sheet.visibleBox.xmax, ymax))
sheet.refresh()
|
def set_y(sheet, s):
ymin, ymax = map(float, map(sheet.ycols[0].type, s.split()))
sheet.zoomTo(BoundingBox(sheet.visibleBox.xmin, ymin, sheet.visibleBox.xmax, ymax))
sheet.refresh()
|
https://github.com/saulpw/visidata/issues/637
|
Traceback (most recent call last):
File "/Users/Documents/pyv/py3/lib/python3.7/site-packages/visidata/basesheet.py", line 127, in execCommand
exec(code, vdglobals, LazyChainMap(vd, self))
File "release-mouse", line 1, in <module>
import math
NameError: name 'mouseX' is not defined
|
NameError
|
def set_x(sheet, s):
xmin, xmax = map(float, map(sheet.parseX, s.split()))
sheet.zoomTo(BoundingBox(xmin, sheet.visibleBox.ymin, xmax, sheet.visibleBox.ymax))
sheet.refresh()
|
def set_x(sheet, s):
xmin, xmax = map(float, map(sheet.xcols[0].type, s.split()))
sheet.zoomTo(BoundingBox(xmin, sheet.visibleBox.ymin, xmax, sheet.visibleBox.ymax))
sheet.refresh()
|
https://github.com/saulpw/visidata/issues/637
|
Traceback (most recent call last):
File "/Users/Documents/pyv/py3/lib/python3.7/site-packages/visidata/basesheet.py", line 127, in execCommand
exec(code, vdglobals, LazyChainMap(vd, self))
File "release-mouse", line 1, in <module>
import math
NameError: name 'mouseX' is not defined
|
NameError
|
def reload(self):
# key rows become column names
col = Column(
"_".join(c.name for c in self.source.keyCols),
getter=lambda c, origcol: origcol.name,
)
# associate column with sheet
col.recalc(self)
self.columns = [col]
self.setKeys(self.columns)
# rows become columns
for row in Progress(self.source.rows, "transposing"):
self.addColumn(
Column(
"_".join(map(str, self.source.rowkey(row))),
getter=lambda c, origcol, row=row: origcol.getValue(row),
)
)
# columns become rows
self.rows = list(self.source.nonKeyVisibleCols)
|
def reload(self):
# key rows become column names
col = Column(
"_".join(c.name for c in self.source.keyCols),
getter=lambda c, origcol: origcol.name,
)
# associate column with sheet
col.recalc(self)
self.columns = [col]
self.setKeys(self.columns)
# rows become columns
for row in Progress(self.source.rows, "transposing"):
self.addColumn(
Column(
"_".join(self.source.rowkey(row)),
getter=lambda c, origcol, row=row: origcol.getValue(row),
)
)
# columns become rows
self.rows = list(self.source.nonKeyVisibleCols)
|
https://github.com/saulpw/visidata/issues/631
|
Traceback (most recent call last):
File "/usr/env/lib/python3.8/site-packages/visidata/threads.py", line 207, in _toplevelTryFunc
t.status = func(*args, **kwargs)
File "/usr/env/lib/python3.8/site-packages/visidata/transpose.py", line 18, in reload
self.addColumn(Column('_'.join(self.source.rowkey(row)),
TypeError: sequence item 0: expected str instance, int found
|
TypeError
|
def parseArgs(vd, parser: argparse.ArgumentParser):
addOptions(parser)
args, remaining = parser.parse_known_args()
# add visidata_dir to path before loading config file (can only be set from cli)
sys.path.append(str(visidata.Path(args.visidata_dir or options.visidata_dir)))
# import plugins from .visidata/plugins before .visidatarc, so plugin options can be overridden
for modname in args.imports.split():
try:
addGlobals(importlib.import_module(modname).__dict__)
except ModuleNotFoundError:
continue
# user customisations in config file in standard location
loadConfigFile(visidata.Path(args.config or options.config), getGlobals())
# add plugin options and reparse
addOptions(parser)
args, remaining = parser.parse_known_args()
# apply command-line overrides after .visidatarc
for optname, optval in vars(args).items():
if optval is not None and optname not in [
"inputs",
"play",
"batch",
"output",
"diff",
]:
options[optname] = optval
return args
|
def parseArgs(vd, parser: argparse.ArgumentParser):
addOptions(parser)
args, remaining = parser.parse_known_args()
# add visidata_dir to path before loading config file (can only be set from cli)
sys.path.append(str(visidata.Path(args.visidata_dir or options.visidata_dir)))
# import plugins from .visidata/plugins before .visidatarc, so plugin options can be overridden
for modname in args.imports.split():
addGlobals(importlib.import_module(modname).__dict__)
# user customisations in config file in standard location
loadConfigFile(visidata.Path(args.config or options.config), getGlobals())
# add plugin options and reparse
addOptions(parser)
args, remaining = parser.parse_known_args()
# apply command-line overrides after .visidatarc
for optname, optval in vars(args).items():
if optval is not None and optname not in [
"inputs",
"play",
"batch",
"output",
"diff",
]:
options[optname] = optval
return args
|
https://github.com/saulpw/visidata/issues/614
|
Traceback (most recent call last):
File "/usr/bin/vd", line 6, in <module>
visidata.main.vd_cli()
File "/usr/lib/python3.8/site-packages/visidata/main.py", line 220, in vd_cli
rc = main_vd()
File "/usr/lib/python3.8/site-packages/visidata/main.py", line 75, in main_vd
args = vd.parseArgs(parser)
File "/usr/lib/python3.8/site-packages/visidata/settings.py", line 312, in parseArgs
addGlobals(importlib.import_module(modname).__dict__)
File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 973, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'plugins'
|
ModuleNotFoundError
|
def drawRightStatus(vd, scr, vs):
"Draw right side of status bar. Return length displayed."
rightx = vs.windowWidth
ret = 0
statcolors = [
(vd.rightStatus(vs), "color_status"),
]
active = vs is vd.sheets[0] # active sheet
if active:
statcolors.append((vd.keystrokes or "", "color_keystrokes"))
if vs.currentThreads:
statcolors.insert(0, vd.checkMemoryUsage())
if vs.progresses:
gerund = vs.progresses[0].gerund
else:
gerund = "processing"
statcolors.insert(1, (" %s %sβ¦" % (vs.progressPct, gerund), "color_status"))
if active and vd.currentReplay:
statcolors.insert(0, (vd.replayStatus, "color_status_replay"))
for rstatcolor in statcolors:
if rstatcolor:
try:
rstatus, coloropt = rstatcolor
rstatus = " " + rstatus
cattr = colors.get_color(coloropt)
if scr is vd.winTop:
cattr = update_attr(cattr, colors.color_top_status, 0)
if active:
cattr = update_attr(cattr, colors.color_active_status, 0)
else:
cattr = update_attr(cattr, colors.color_inactive_status, 0)
statuslen = clipdraw(
scr,
vs.windowHeight - 1,
rightx,
rstatus,
cattr.attr,
w=vs.windowWidth - 1,
rtl=True,
)
rightx -= statuslen
ret += statuslen
except Exception as e:
vd.exceptionCaught(e)
if scr:
curses.doupdate()
return ret
|
def drawRightStatus(vd, scr, vs):
"Draw right side of status bar. Return length displayed."
rightx = vs.windowWidth
ret = 0
statcolors = [
(vd.rightStatus(vs), "color_status"),
]
active = vs is vd.sheets[0] # active sheet
if active:
statcolors.append((vd.keystrokes, "color_keystrokes"))
if vs.currentThreads:
statcolors.insert(0, vd.checkMemoryUsage())
if vs.progresses:
gerund = vs.progresses[0].gerund
else:
gerund = "processing"
statcolors.insert(1, (" %s %sβ¦" % (vs.progressPct, gerund), "color_status"))
if active and vd.currentReplay:
statcolors.insert(0, (vd.replayStatus, "color_status_replay"))
for rstatcolor in statcolors:
if rstatcolor:
try:
rstatus, coloropt = rstatcolor
rstatus = " " + rstatus
cattr = colors.get_color(coloropt)
if scr is vd.winTop:
cattr = update_attr(cattr, colors.color_top_status, 0)
if active:
cattr = update_attr(cattr, colors.color_active_status, 0)
else:
cattr = update_attr(cattr, colors.color_inactive_status, 0)
statuslen = clipdraw(
scr,
vs.windowHeight - 1,
rightx,
rstatus,
cattr.attr,
w=vs.windowWidth - 1,
rtl=True,
)
rightx -= statuslen
ret += statuslen
except Exception as e:
vd.exceptionCaught(e)
if scr:
curses.doupdate()
return ret
|
https://github.com/saulpw/visidata/issues/577
|
Traceback (most recent call last):
File "/Users/akerrigan/code/visidata/visidata/statusbar.py", line 183, in drawRightStatus
rstatus = ' '+rstatus
TypeError: can only concatenate str (not "NoneType") to str
|
TypeError
|
def numericFormatter(fmtstr, typedval):
try:
fmtstr = fmtstr or options["disp_" + type(typedval).__name__ + "_fmt"]
if fmtstr[0] == "%":
return locale.format_string(fmtstr, typedval, grouping=True)
else:
return fmtstr.format(typedval)
except ValueError:
return str(typedval)
|
def numericFormatter(fmtstr, typedval):
fmtstr = fmtstr or options["disp_" + type(typedval).__name__ + "_fmt"]
if fmtstr:
if fmtstr[0] == "%":
return locale.format_string(fmtstr, typedval, grouping=True)
else:
return fmtstr.format(typedval)
return str(typedval)
|
https://github.com/saulpw/visidata/issues/584
|
Traceback (most recent call last):
File "/usr/lib/python3.8/site-packages/visidata/column.py", line 247, in getCell
dw.display = self.format(typedval) or ''
File "/usr/lib/python3.8/site-packages/visidata/column.py", line 140, in format
return getType(self.type).formatter(self.fmtstr, typedval)
File "/usr/lib/python3.8/site-packages/visidata/_types.py", line 40, in numericFormatter
fmtstr = fmtstr or options['disp_'+type(typedval).__name__+'_fmt']
File "/usr/lib/python3.8/site-packages/visidata/settings.py", line 199, in __getitem__
vd.error('no option "%s"' % k)
File "/usr/lib/python3.8/site-packages/visidata/statusbar.py", line 55, in error
raise ExpectedException(args[0] if args else '')
visidata.errors.ExpectedException: no option "disp_bool_fmt"
|
visidata.errors.ExpectedException
|
def reload(self):
# key rows become column names
col = Column(
"_".join(c.name for c in self.source.keyCols),
getter=lambda c, origcol: origcol.name,
)
# associate column with sheet
col.recalc(self)
self.columns = [col]
self.setKeys(self.columns)
# rows become columns
for row in Progress(self.source.rows, "transposing"):
self.addColumn(
Column(
"_".join(self.source.rowkey(row)),
getter=lambda c, origcol, row=row: origcol.getValue(row),
)
)
# columns become rows
self.rows = list(self.source.nonKeyVisibleCols)
|
def reload(self):
# key rows become column names
self.columns = [
Column(
"_".join(c.name for c in self.source.keyCols),
getter=lambda c, origcol: origcol.name,
)
]
self.setKeys(self.columns)
# rows become columns
for row in Progress(self.source.rows, "transposing"):
self.addColumn(
Column(
"_".join(self.source.rowkey(row)),
getter=lambda c, origcol, row=row: origcol.getValue(row),
)
)
# columns become rows
self.rows = list(self.source.nonKeyVisibleCols)
|
https://github.com/saulpw/visidata/issues/581
|
Traceback (most recent call last):
File "/usr/lib/python3.8/site-packages/visidata/basesheet.py", line 127, in execCommand
exec(code, vdglobals, LazyChainMap(vd, self))
File "pyobj-cell", line 1, in <module>
import math
File "/usr/lib/python3.8/site-packages/visidata/basesheet.py", line 30, in __getitem__
return getattr(obj, k)
File "/usr/lib/python3.8/site-packages/visidata/sheets.py", line 419, in cursorValue
return self.cursorCol.getValue(self.cursorRow)
File "/usr/lib/python3.8/site-packages/visidata/column.py", line 182, in getValue
if self.sheet.defer:
AttributeError: 'NoneType' object has no attribute 'defer'
|
AttributeError
|
def openRow(self, row):
k = self.rowkey(row) or [self.cursorRowIndex]
name = f"{self.name}[{self.keystr(row)}]"
return vd.load_pyobj(name, tuple(c.getTypedValue(row) for c in self.visibleCols))
|
def openRow(self, row):
k = self.rowkey(row) or [self.cursorRowIndex]
name = f"{self.name}[{self.keystr(row)}]"
return vd.load_pyobj(tuple(c.getTypedValue(row) for c in self.visibleCols))
|
https://github.com/saulpw/visidata/issues/557
|
Traceback (most recent call last):
File "/usr/lib/visidata/basesheet.py", line 126, in execCommand
exec(code, vdglobals, LazyChainMap(vd, self))
File "dive-row", line 1, in <module>
import math
File "/usr/lib/visidata/sheets.py", line 241, in openRow
return vd.load_pyobj(tuple(c.getTypedValue(row) for c in self.visibleCols)) TypeError: load_pyobj() missing 1 required positional argument: 'obj"
|
TypeError
|
def openRow(self, row):
return load_pyobj("%s[%s]" % (self.name, self.keystr(row)), row)
|
def openRow(self, row):
return load_pyobj("%s[%s]" % (name, rowIndex), row)
|
https://github.com/saulpw/visidata/issues/557
|
Traceback (most recent call last):
File "/usr/lib/visidata/basesheet.py", line 126, in execCommand
exec(code, vdglobals, LazyChainMap(vd, self))
File "dive-row", line 1, in <module>
import math
File "/usr/lib/visidata/sheets.py", line 241, in openRow
return vd.load_pyobj(tuple(c.getTypedValue(row) for c in self.visibleCols)) TypeError: load_pyobj() missing 1 required positional argument: 'obj"
|
TypeError
|
def openRow(self, row):
k = self.rowkey(row) or [self.cursorRowIndex]
name = f"{self.name}[{k}]"
return vd.load_pyobj(name, tuple(c.getTypedValue(row) for c in self.visibleCols))
|
def openRow(self, row):
k = self.rowkey(row) or [self.cursorRowIndex]
name = f"{self.name}[{self.keystr(row)}]"
return vd.load_pyobj(name, tuple(c.getTypedValue(row) for c in self.visibleCols))
|
https://github.com/saulpw/visidata/issues/557
|
Traceback (most recent call last):
File "/usr/lib/visidata/basesheet.py", line 126, in execCommand
exec(code, vdglobals, LazyChainMap(vd, self))
File "dive-row", line 1, in <module>
import math
File "/usr/lib/visidata/sheets.py", line 241, in openRow
return vd.load_pyobj(tuple(c.getTypedValue(row) for c in self.visibleCols)) TypeError: load_pyobj() missing 1 required positional argument: 'obj"
|
TypeError
|
def openCell(self, col, row):
k = self.keystr(row) or [str(self.cursorRowIndex)]
name = f"{self.name}.{col.name}[{k}]"
return vd.load_pyobj(name, col.getTypedValue(row))
|
def openCell(self, col, row):
k = self.keystr(row) or [str(self.cursorRowIndex)]
name = f"{self.name}.{col.name}[{self.keystr(row)}]"
return vd.load_pyobj(name, col.getTypedValue(row))
|
https://github.com/saulpw/visidata/issues/557
|
Traceback (most recent call last):
File "/usr/lib/visidata/basesheet.py", line 126, in execCommand
exec(code, vdglobals, LazyChainMap(vd, self))
File "dive-row", line 1, in <module>
import math
File "/usr/lib/visidata/sheets.py", line 241, in openRow
return vd.load_pyobj(tuple(c.getTypedValue(row) for c in self.visibleCols)) TypeError: load_pyobj() missing 1 required positional argument: 'obj"
|
TypeError
|
def save_html(vd, p, *vsheets):
"Save vsheets as HTML tables in a single file"
with open(p, "w", encoding="ascii", errors="xmlcharrefreplace") as fp:
for sheet in vsheets:
fp.write(
'<h2 class="sheetname">%s</h2>\n'.format(
sheetname=html.escape(sheet.name)
)
)
fp.write(
'<table id="{sheetname}">\n'.format(sheetname=html.escape(sheet.name))
)
# headers
fp.write("<tr>")
for col in sheet.visibleCols:
contents = html.escape(col.name)
fp.write("<th>{colname}</th>".format(colname=contents))
fp.write("</tr>\n")
# rows
with Progress(gerund="saving"):
for typedvals in sheet.iterdispvals(format=False):
fp.write("<tr>")
for col, val in typedvals.items():
fp.write("<td>")
fp.write(html.escape(str(val)))
fp.write("</td>")
fp.write("</tr>\n")
fp.write("</table>")
vd.status("%s save finished" % p)
|
def save_html(vd, p, *vsheets):
"Save vsheets as HTML tables in a single file"
with open(p, "w", encoding="ascii", errors="xmlcharrefreplace") as fp:
for sheet in vsheets:
fp.write(
'<h2 class="sheetname">%s</h2>\n'.format(
sheetname=html.escape(sheet.name)
)
)
fp.write(
'<table id="{sheetname}">\n'.format(sheetname=html.escape(sheet.name))
)
# headers
fp.write("<tr>")
for col in sheet.visibleCols:
contents = html.escape(col.name)
fp.write("<th>{colname}</th>".format(colname=contents))
fp.write("</tr>\n")
# rows
with Progress(gerund="saving"):
for typedvals in sheet.iterdispvals(format=False):
fp.write("<tr>")
for col, val in typedvals.items():
fp.write("<td>")
fp.write(html.escape(val))
fp.write("</td>")
fp.write("</tr>\n")
fp.write("</table>")
vd.status("%s save finished" % p)
|
https://github.com/saulpw/visidata/issues/501
|
Traceback (most recent call last):
File "/Documents/pyv/py3/lib/python3.7/site-packages/visidata/threads.py", line 201, in _toplevelTryFunc
t.status = func(*args, **kwargs)
File "/Documents/pyv/py3/lib/python3.7/site-packages/visidata/loaders/html.py", line 124, in save_html
fp.write(html.escape(val))
File "/usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/html/__init__.py", line 19, in escape
s = s.replace("&", "&amp;") # Must be done first!
AttributeError: 'vlen' object has no attribute 'replace'
|
AttributeError
|
def __getattr__(self, k):
if hasattr(self.__dict__, k):
r = getattr(self.__dict__, k)
else:
if self.__dict__.get("_path", None) is not None:
r = getattr(self._path, k)
else:
raise AttributeError(k)
if isinstance(r, pathlib.Path):
return Path(r)
return r
|
def __getattr__(self, k):
if hasattr(self.__dict__, k):
r = getattr(self.__dict__, k)
else:
r = getattr(self._path, k)
if isinstance(r, pathlib.Path):
return Path(r)
return r
|
https://github.com/saulpw/visidata/issues/489
|
Traceback (most recent call last):
File "/path/vd_plugins/radare2/r2/lib/python3.7/site-packages/visidata-2._4dev-py3.7.egg/visidata/threads.py", line 201, in _toplevelTryFunc
t.status = func(*args, **kwargs)
File "/path/vd_plugins/radare2/r2/lib/python3.7/site-packages/visidata-2._4dev-py3.7.egg/visidata/threads.py", line 80, in _async_deepcopy
newlist.append(deepcopy(r))
File "/usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/copy.py", line 180, in deepcopy
y = _reconstruct(x, memo, *rv)
File "/usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/copy.py", line 281, in _reconstruct
if hasattr(y, '__setstate__'):
File "/path/vd_plugins/radare2/r2/lib/python3.7/site-packages/visidata-2._4dev-py3.7.egg/visidata/path.py", line 77, in __getattr__
r = getattr(self._path, k)
File "/path/vd_plugins/radare2/r2/lib/python3.7/site-packages/visidata-2._4dev-py3.7.egg/visidata/path.py", line 77, in __getattr__
r = getattr(self._path, k)
File "/path/vd_plugins/radare2/r2/lib/python3.7/site-packages/visidata-2._4dev-py3.7.egg/visidata/path.py", line 77, in __getattr__
r = getattr(self._path, k)
[Previous line repeated 492 more times]
RecursionError: maximum recursion depth exceeded
|
RecursionError
|
def open_fixed(p):
return FixedWidthColumnsSheet(p.name, source=p, headerlines=[])
|
def open_fixed(p):
return FixedWidthColumnsSheet(p.name, source=p)
|
https://github.com/saulpw/visidata/issues/439
|
Traceback (most recent call last):
File "/usr/lib/python3/site-packages/visidata/threads.py", line 202, in _toplevelTryFunc
t.status = func(*args, **kwargs)
File "/usr/lib/python3/site-packages/visidata/sheets.py", line 828, in reload
list(self.optlines(itsource, 'skip'))
File "/usr/lib/python3/site-packages/visidata/sheets.py", line 817, in optlines
yield next(it)
File "/usr/lib/python3/site-packages/visidata/loaders/fixed_width.py", line 67, in iterload
self.setColNames(self.headerlines)
AttributeError: 'FixedWidthColumnsSheet' object has no attribute 'headerlines'
|
AttributeError
|
def bindkey(keystrokes, longname):
bindkeys.setdefault(keystrokes, longname)
|
def bindkey(cls, keystrokes, longname):
oldlongname = bindkeys._get(keystrokes, cls)
if oldlongname:
vd.warning("%s was already bound to %s" % (keystrokes, oldlongname))
bindkeys.set(keystrokes, longname, cls)
|
https://github.com/saulpw/visidata/issues/379
|
Traceback (most recent call last):
File "/home/sfranky/.local/lib/python3.7/site-packages/visidata/settings.py", line 257, in loadConfigFile
exec(code, _globals or globals())
File "/home/sfranky/.visidatarc", line 19, in <module>
bindkey('0', 'go-leftmost')
TypeError: 'classmethod' object is not callable
|
TypeError
|
def unbindkey(keystrokes):
bindkeys.unset(keystrokes)
|
def unbindkey(cls, keystrokes):
bindkeys.unset(keystrokes, cls)
|
https://github.com/saulpw/visidata/issues/379
|
Traceback (most recent call last):
File "/home/sfranky/.local/lib/python3.7/site-packages/visidata/settings.py", line 257, in loadConfigFile
exec(code, _globals or globals())
File "/home/sfranky/.visidatarc", line 19, in <module>
bindkey('0', 'go-leftmost')
TypeError: 'classmethod' object is not callable
|
TypeError
|
def reload(self):
from pkg_resources import resource_filename
cmdlist = TsvSheet(
"cmdlist", source=Path(resource_filename(__name__, "commands.tsv"))
)
options.set("delimiter", vd_system_sep, cmdlist)
cmdlist.reload_sync()
self.rows = []
for (k, o), v in commands.iter(self.source):
self.addRow(v)
v.sheet = o
self.cmddict = {}
for cmdrow in cmdlist.rows:
self.cmddict[(cmdrow.sheet, cmdrow.longname)] = cmdrow
self.revbinds = {} # [longname] -> keystrokes
for (keystrokes, _), longname in bindkeys.iter(self.source):
if keystrokes not in self.revbinds:
self.revbinds[longname] = keystrokes
|
def reload(self):
from pkg_resources import resource_filename
cmdlist = TsvSheet(
"cmdlist", source=Path(resource_filename(__name__, "commands.tsv"))
)
cmdlist.reload_sync()
self.rows = []
for (k, o), v in commands.iter(self.source):
self.addRow(v)
v.sheet = o
self.cmddict = {}
for cmdrow in cmdlist.rows:
self.cmddict[(cmdrow.sheet, cmdrow.longname)] = cmdrow
self.revbinds = {} # [longname] -> keystrokes
for (keystrokes, _), longname in bindkeys.iter(self.source):
if keystrokes not in self.revbinds:
self.revbinds[longname] = keystrokes
|
https://github.com/saulpw/visidata/issues/323
|
==> cell_err.txt <==
Traceback (most recent call last):
File "/usr/lib/python3.6/site-packages/visidata/wrappers.py", line 95, in wrapply
return func(*args, **kwargs)
File "/usr/lib/python3.6/site-packages/visidata/column.py", line 168, in getValue
return self.calcValue(row)
File "/usr/lib/python3.6/site-packages/visidata/column.py", line 136, in calcValue
return (self.getter)(self, row)
File "/usr/lib/python3.6/site-packages/visidata/metasheets.py", line 83, in <lambda>
Column('description', getter=lambda col,row: col.sheet.cmddict[(row.sheet, row.longname)].helpstr),
KeyError: ('Sheet', 'show-cursor')
==> last_err.txt <==
Traceback (most recent call last):
File "/usr/lib/python3.6/site-packages/visidata/utils.py", line 76, in __getattr__
return self[self._fields.index(k)]
ValueError: 'sheet' is not in list
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3.6/site-packages/visidata/threads.py", line 191, in _toplevelTryFunc
t.status = func(*args, **kwargs)
File "/usr/lib/python3.6/site-packages/visidata/metasheets.py", line 101, in reload
self.cmddict[(cmdrow.sheet, cmdrow.longname)] = cmdrow
File "/usr/lib/python3.6/site-packages/visidata/utils.py", line 78, in __getattr__
raise AttributeError
AttributeError
|
KeyError
|
def execute(self, conn, sql, where={}, parms=None):
parms = parms or []
if where:
sql += " WHERE %s" % " AND ".join('"%s"=?' % k for k in where)
status(sql)
parms += list(where.values())
return conn.execute(sql, parms)
|
def execute(self, conn, sql, where={}, parms=None):
parms = parms or []
if where:
sql += " WHERE %s" % " AND ".join("%s=?" % k for k in where)
status(sql)
parms += list(where.values())
return conn.execute(sql, parms)
|
https://github.com/saulpw/visidata/issues/369
|
Traceback (most recent call last): β
File "/usr/lib/python3/dist-packages/visidata/vdtui.py", line 1115, in exec_command β
exec(cmd.execstr, vdglobals, LazyMap(self)) β
File "<string>", line 1, in <module> β
File "/usr/lib/python3/dist-packages/visidata/vdtui.py", line 961, in push β
vs.reload() β
File "/usr/lib/python3/dist-packages/visidata/loaders/sqlite.py", line 24, in reload β
self.columns = self.getColumns(tblname) β
File "/usr/lib/python3/dist-packages/visidata/loaders/sqlite.py", line 33, in getColumns β
for i, r in enumerate(self.conn.execute('PRAGMA TABLE_INFO(%s)' % tableName)): β
sqlite3.OperationalError: near "select": syntax error β
|
sqlite3.OperationalError
|
def reload_sync(self, _conn=None):
self.reset()
with _conn or self.conn() as conn:
tblname = self.tableName
self.columns = self.getColumns(tblname, conn)
self.recalc()
r = self.execute(conn, 'SELECT COUNT(*) FROM "%s"' % tblname).fetchall()
rowcount = r[0][0]
self.rows = []
for row in Progress(
self.execute(conn, 'SELECT * FROM "%s"' % tblname), total=rowcount - 1
):
self.addRow(row)
|
def reload_sync(self, _conn=None):
self.reset()
with _conn or self.conn() as conn:
tblname = self.tableName
self.columns = self.getColumns(tblname, conn)
self.recalc()
r = self.execute(conn, "SELECT COUNT(*) FROM %s" % tblname).fetchall()
rowcount = r[0][0]
self.rows = []
for row in Progress(
self.execute(conn, "SELECT * FROM %s" % tblname), total=rowcount - 1
):
self.addRow(row)
|
https://github.com/saulpw/visidata/issues/369
|
Traceback (most recent call last): β
File "/usr/lib/python3/dist-packages/visidata/vdtui.py", line 1115, in exec_command β
exec(cmd.execstr, vdglobals, LazyMap(self)) β
File "<string>", line 1, in <module> β
File "/usr/lib/python3/dist-packages/visidata/vdtui.py", line 961, in push β
vs.reload() β
File "/usr/lib/python3/dist-packages/visidata/loaders/sqlite.py", line 24, in reload β
self.columns = self.getColumns(tblname) β
File "/usr/lib/python3/dist-packages/visidata/loaders/sqlite.py", line 33, in getColumns β
for i, r in enumerate(self.conn.execute('PRAGMA TABLE_INFO(%s)' % tableName)): β
sqlite3.OperationalError: near "select": syntax error β
|
sqlite3.OperationalError
|
def commit(self, adds, changes, deletes):
options_safe_error = options.safe_error
def value(row, col):
v = col.getTypedValue(row)
if isinstance(v, TypedWrapper):
if isinstance(v, TypedExceptionWrapper):
return options_safe_error
else:
return None
return v
def values(row, cols):
vals = []
for c in cols:
vals.append(value(row, c))
return vals
with self.conn() as conn:
wherecols = self.keyCols or self.visibleCols
for r in adds:
cols = self.visibleCols
sql = 'INSERT INTO "%s" ' % self.tableName
sql += '("%s")' % ",".join(c.name for c in cols)
sql += "VALUES (%s)" % ",".join("?" for c in cols)
self.execute(conn, sql, parms=values(r, cols))
for r, changedcols in changes:
sql = 'UPDATE "%s" SET ' % self.tableName
sql += ", ".join('"%s"=?' % c.name for c in changedcols)
self.execute(
conn,
sql,
where={c.name: c.getSavedValue(r) for c in wherecols},
parms=values(r, changedcols),
)
for r in deletes:
self.execute(
conn,
'DELETE FROM "%s" ' % self.tableName,
where={c.name: c.getTypedValue(r) for c in wherecols},
)
conn.commit()
self.reload()
|
def commit(self, adds, changes, deletes):
options_safe_error = options.safe_error
def value(row, col):
v = col.getTypedValue(row)
if isinstance(v, TypedWrapper):
if isinstance(v, TypedExceptionWrapper):
return options_safe_error
else:
return None
return v
def values(row, cols):
vals = []
for c in cols:
vals.append(value(row, c))
return vals
with self.conn() as conn:
wherecols = self.keyCols or self.visibleCols
for r in adds:
cols = self.visibleCols
sql = "INSERT INTO %s " % self.tableName
sql += "(%s)" % ",".join(c.name for c in cols)
sql += "VALUES (%s)" % ",".join("?" for c in cols)
self.execute(conn, sql, parms=values(r, cols))
for r, changedcols in changes:
sql = "UPDATE %s SET " % self.tableName
sql += ", ".join("%s=?" % c.name for c in changedcols)
self.execute(
conn,
sql,
where={c.name: c.getSavedValue(r) for c in wherecols},
parms=values(r, changedcols),
)
for r in deletes:
self.execute(
conn,
"DELETE FROM %s " % self.tableName,
where={c.name: c.getTypedValue(r) for c in wherecols},
)
conn.commit()
self.reload()
|
https://github.com/saulpw/visidata/issues/369
|
Traceback (most recent call last): β
File "/usr/lib/python3/dist-packages/visidata/vdtui.py", line 1115, in exec_command β
exec(cmd.execstr, vdglobals, LazyMap(self)) β
File "<string>", line 1, in <module> β
File "/usr/lib/python3/dist-packages/visidata/vdtui.py", line 961, in push β
vs.reload() β
File "/usr/lib/python3/dist-packages/visidata/loaders/sqlite.py", line 24, in reload β
self.columns = self.getColumns(tblname) β
File "/usr/lib/python3/dist-packages/visidata/loaders/sqlite.py", line 33, in getColumns β
for i, r in enumerate(self.conn.execute('PRAGMA TABLE_INFO(%s)' % tableName)): β
sqlite3.OperationalError: near "select": syntax error β
|
sqlite3.OperationalError
|
def getColumns(self, tableName, conn):
cols = []
for i, r in enumerate(self.execute(conn, 'PRAGMA TABLE_INFO("%s")' % tableName)):
c = DeferredSetColumn(
r[1],
getter=lambda col, row, idx=i: row[idx],
setter=lambda col, row, val: col.sheet.commit(),
)
t = r[2].lower()
if t == "integer":
c.type = int
elif t == "text":
c.type = anytype
elif t == "blob":
c.type = str
elif t == "real":
c.type = float
else:
status('unknown sqlite type "%s"' % t)
cols.append(c)
if r[-1]:
self.setKeys([c])
return cols
|
def getColumns(self, tableName, conn):
cols = []
for i, r in enumerate(self.execute(conn, "PRAGMA TABLE_INFO(%s)" % tableName)):
c = DeferredSetColumn(
r[1],
getter=lambda col, row, idx=i: row[idx],
setter=lambda col, row, val: col.sheet.commit(),
)
t = r[2].lower()
if t == "integer":
c.type = int
elif t == "text":
c.type = anytype
elif t == "blob":
c.type = str
elif t == "real":
c.type = float
else:
status('unknown sqlite type "%s"' % t)
cols.append(c)
if r[-1]:
self.setKeys([c])
return cols
|
https://github.com/saulpw/visidata/issues/369
|
Traceback (most recent call last): β
File "/usr/lib/python3/dist-packages/visidata/vdtui.py", line 1115, in exec_command β
exec(cmd.execstr, vdglobals, LazyMap(self)) β
File "<string>", line 1, in <module> β
File "/usr/lib/python3/dist-packages/visidata/vdtui.py", line 961, in push β
vs.reload() β
File "/usr/lib/python3/dist-packages/visidata/loaders/sqlite.py", line 24, in reload β
self.columns = self.getColumns(tblname) β
File "/usr/lib/python3/dist-packages/visidata/loaders/sqlite.py", line 33, in getColumns β
for i, r in enumerate(self.conn.execute('PRAGMA TABLE_INFO(%s)' % tableName)): β
sqlite3.OperationalError: near "select": syntax error β
|
sqlite3.OperationalError
|
def multisave_sqlite(p, *vsheets):
import sqlite3
conn = sqlite3.connect(p.resolve())
c = conn.cursor()
for vs in vsheets:
tblname = clean_to_id(vs.name)
sqlcols = []
for col in vs.visibleCols:
sqlcols.append('"%s" %s' % (col.name, sqlite_type(col.type)))
sql = 'CREATE TABLE IF NOT EXISTS "%s" (%s)' % (tblname, ", ".join(sqlcols))
c.execute(sql)
for r in Progress(vs.rows, "saving"):
sqlvals = []
for col in vs.visibleCols:
sqlvals.append(col.getTypedValue(r))
sql = 'INSERT INTO "%s" VALUES (%s)' % (
tblname,
",".join(["?"] * len(sqlvals)),
)
c.execute(sql, sqlvals)
conn.commit()
status("%s save finished" % p)
|
def multisave_sqlite(p, *vsheets):
import sqlite3
conn = sqlite3.connect(p.resolve())
c = conn.cursor()
for vs in vsheets:
tblname = clean_to_id(vs.name)
sqlcols = []
for col in vs.visibleCols:
sqlcols.append("%s %s" % (col.name, sqlite_type(col.type)))
sql = "CREATE TABLE IF NOT EXISTS %s (%s)" % (tblname, ", ".join(sqlcols))
c.execute(sql)
for r in Progress(vs.rows, "saving"):
sqlvals = []
for col in vs.visibleCols:
sqlvals.append(col.getTypedValue(r))
sql = "INSERT INTO %s VALUES (%s)" % (
tblname,
",".join(["?"] * len(sqlvals)),
)
c.execute(sql, sqlvals)
conn.commit()
status("%s save finished" % p)
|
https://github.com/saulpw/visidata/issues/369
|
Traceback (most recent call last): β
File "/usr/lib/python3/dist-packages/visidata/vdtui.py", line 1115, in exec_command β
exec(cmd.execstr, vdglobals, LazyMap(self)) β
File "<string>", line 1, in <module> β
File "/usr/lib/python3/dist-packages/visidata/vdtui.py", line 961, in push β
vs.reload() β
File "/usr/lib/python3/dist-packages/visidata/loaders/sqlite.py", line 24, in reload β
self.columns = self.getColumns(tblname) β
File "/usr/lib/python3/dist-packages/visidata/loaders/sqlite.py", line 33, in getColumns β
for i, r in enumerate(self.conn.execute('PRAGMA TABLE_INFO(%s)' % tableName)): β
sqlite3.OperationalError: near "select": syntax error β
|
sqlite3.OperationalError
|
def reload_sync(self, _conn=None):
with _conn or self.conn() as conn:
tblname = self.tableName
self.columns = self.getColumns(tblname, conn)
self.recalc()
r = self.execute(conn, 'SELECT COUNT(*) FROM "%s"' % tblname).fetchall()
rowcount = r[0][0]
self.rows = []
for row in Progress(
self.execute(conn, 'SELECT * FROM "%s"' % tblname), total=rowcount - 1
):
self.addRow(row)
|
def reload_sync(self, _conn=None):
with _conn or self.conn() as conn:
tblname = self.tableName
self.columns = self.getColumns(tblname, conn)
self.recalc()
r = self.execute(conn, "SELECT COUNT(*) FROM %s" % tblname).fetchall()
rowcount = r[0][0]
self.rows = []
for row in Progress(
self.execute(conn, "SELECT * FROM %s" % tblname), total=rowcount - 1
):
self.addRow(row)
|
https://github.com/saulpw/visidata/issues/369
|
Traceback (most recent call last): β
File "/usr/lib/python3/dist-packages/visidata/vdtui.py", line 1115, in exec_command β
exec(cmd.execstr, vdglobals, LazyMap(self)) β
File "<string>", line 1, in <module> β
File "/usr/lib/python3/dist-packages/visidata/vdtui.py", line 961, in push β
vs.reload() β
File "/usr/lib/python3/dist-packages/visidata/loaders/sqlite.py", line 24, in reload β
self.columns = self.getColumns(tblname) β
File "/usr/lib/python3/dist-packages/visidata/loaders/sqlite.py", line 33, in getColumns β
for i, r in enumerate(self.conn.execute('PRAGMA TABLE_INFO(%s)' % tableName)): β
sqlite3.OperationalError: near "select": syntax error β
|
sqlite3.OperationalError
|
def putChanges(self, path, adds, mods, dels):
options_safe_error = options.safe_error
def value(row, col):
v = col.getTypedValue(row)
if isinstance(v, TypedWrapper):
if isinstance(v, TypedExceptionWrapper):
return options_safe_error
else:
return None
return v
def values(row, cols):
vals = []
for c in cols:
vals.append(value(row, c))
return vals
with self.conn() as conn:
wherecols = self.keyCols or self.visibleCols
for r in adds.values():
cols = self.visibleCols
sql = 'INSERT INTO "%s" ' % self.tableName
sql += "(%s)" % ",".join(c.name for c in cols)
sql += "VALUES (%s)" % ",".join("?" for c in cols)
self.execute(conn, sql, parms=values(r, cols))
for row, rowmods in mods.values():
sql = 'UPDATE "%s" SET ' % self.tableName
sql += ", ".join("%s=?" % c.name for c, _ in rowmods.items())
self.execute(
conn,
sql,
where={c.name: c.getSavedValue(row) for c in wherecols},
parms=values(row, [c for c, _ in rowmods.items()]),
)
for r in dels.values():
self.execute(
conn,
'DELETE FROM "%s" ' % self.tableName,
where={c.name: c.getTypedValue(r) for c in wherecols},
)
conn.commit()
self.reload()
self._dm_reset()
|
def putChanges(self, path, adds, mods, dels):
options_safe_error = options.safe_error
def value(row, col):
v = col.getTypedValue(row)
if isinstance(v, TypedWrapper):
if isinstance(v, TypedExceptionWrapper):
return options_safe_error
else:
return None
return v
def values(row, cols):
vals = []
for c in cols:
vals.append(value(row, c))
return vals
with self.conn() as conn:
wherecols = self.keyCols or self.visibleCols
for r in adds.values():
cols = self.visibleCols
sql = "INSERT INTO %s " % self.tableName
sql += "(%s)" % ",".join(c.name for c in cols)
sql += "VALUES (%s)" % ",".join("?" for c in cols)
self.execute(conn, sql, parms=values(r, cols))
for row, rowmods in mods.values():
sql = "UPDATE %s SET " % self.tableName
sql += ", ".join("%s=?" % c.name for c, _ in rowmods.items())
self.execute(
conn,
sql,
where={c.name: c.getSavedValue(row) for c in wherecols},
parms=values(row, [c for c, _ in rowmods.items()]),
)
for r in dels.values():
self.execute(
conn,
"DELETE FROM %s " % self.tableName,
where={c.name: c.getTypedValue(r) for c in wherecols},
)
conn.commit()
self.reload()
self._dm_reset()
|
https://github.com/saulpw/visidata/issues/369
|
Traceback (most recent call last): β
File "/usr/lib/python3/dist-packages/visidata/vdtui.py", line 1115, in exec_command β
exec(cmd.execstr, vdglobals, LazyMap(self)) β
File "<string>", line 1, in <module> β
File "/usr/lib/python3/dist-packages/visidata/vdtui.py", line 961, in push β
vs.reload() β
File "/usr/lib/python3/dist-packages/visidata/loaders/sqlite.py", line 24, in reload β
self.columns = self.getColumns(tblname) β
File "/usr/lib/python3/dist-packages/visidata/loaders/sqlite.py", line 33, in getColumns β
for i, r in enumerate(self.conn.execute('PRAGMA TABLE_INFO(%s)' % tableName)): β
sqlite3.OperationalError: near "select": syntax error β
|
sqlite3.OperationalError
|
def getColumns(self, tableName, conn):
cols = []
for i, r in enumerate(self.execute(conn, 'PRAGMA TABLE_INFO("%s")' % tableName)):
c = Column(r[1], getter=lambda col, row, idx=i: row[idx])
t = r[2].lower()
if t == "integer":
c.type = int
elif t == "text":
c.type = anytype
elif t == "blob":
c.type = str
elif t == "real":
c.type = float
else:
status('unknown sqlite type "%s"' % t)
cols.append(c)
if r[-1]:
self.setKeys([c])
return cols
|
def getColumns(self, tableName, conn):
cols = []
for i, r in enumerate(self.execute(conn, "PRAGMA TABLE_INFO(%s)" % tableName)):
c = Column(r[1], getter=lambda col, row, idx=i: row[idx])
t = r[2].lower()
if t == "integer":
c.type = int
elif t == "text":
c.type = anytype
elif t == "blob":
c.type = str
elif t == "real":
c.type = float
else:
status('unknown sqlite type "%s"' % t)
cols.append(c)
if r[-1]:
self.setKeys([c])
return cols
|
https://github.com/saulpw/visidata/issues/369
|
Traceback (most recent call last): β
File "/usr/lib/python3/dist-packages/visidata/vdtui.py", line 1115, in exec_command β
exec(cmd.execstr, vdglobals, LazyMap(self)) β
File "<string>", line 1, in <module> β
File "/usr/lib/python3/dist-packages/visidata/vdtui.py", line 961, in push β
vs.reload() β
File "/usr/lib/python3/dist-packages/visidata/loaders/sqlite.py", line 24, in reload β
self.columns = self.getColumns(tblname) β
File "/usr/lib/python3/dist-packages/visidata/loaders/sqlite.py", line 33, in getColumns β
for i, r in enumerate(self.conn.execute('PRAGMA TABLE_INFO(%s)' % tableName)): β
sqlite3.OperationalError: near "select": syntax error β
|
sqlite3.OperationalError
|
def multisave_sqlite(p, *vsheets):
import sqlite3
conn = sqlite3.connect(str(p))
c = conn.cursor()
for vs in vsheets:
tblname = clean_to_id(vs.name)
sqlcols = []
for col in vs.visibleCols:
sqlcols.append('"%s" %s' % (col.name, sqlite_type(col.type)))
sql = 'CREATE TABLE IF NOT EXISTS "%s" (%s)' % (tblname, ", ".join(sqlcols))
c.execute(sql)
for r in Progress(vs.rows, "saving"):
sqlvals = []
for col in vs.visibleCols:
sqlvals.append(col.getTypedValue(r))
sql = 'INSERT INTO "%s" VALUES (%s)' % (
tblname,
",".join("?" for v in sqlvals),
)
c.execute(sql, sqlvals)
conn.commit()
status("%s save finished" % p)
|
def multisave_sqlite(p, *vsheets):
import sqlite3
conn = sqlite3.connect(str(p))
c = conn.cursor()
for vs in vsheets:
tblname = clean_to_id(vs.name)
sqlcols = []
for col in vs.visibleCols:
sqlcols.append("%s %s" % (col.name, sqlite_type(col.type)))
sql = "CREATE TABLE IF NOT EXISTS %s (%s)" % (tblname, ", ".join(sqlcols))
c.execute(sql)
for r in Progress(vs.rows, "saving"):
sqlvals = []
for col in vs.visibleCols:
sqlvals.append(col.getTypedValue(r))
sql = "INSERT INTO %s VALUES (%s)" % (
tblname,
",".join(["?"] * len(sqlvals)),
)
c.execute(sql, sqlvals)
conn.commit()
status("%s save finished" % p)
|
https://github.com/saulpw/visidata/issues/369
|
Traceback (most recent call last): β
File "/usr/lib/python3/dist-packages/visidata/vdtui.py", line 1115, in exec_command β
exec(cmd.execstr, vdglobals, LazyMap(self)) β
File "<string>", line 1, in <module> β
File "/usr/lib/python3/dist-packages/visidata/vdtui.py", line 961, in push β
vs.reload() β
File "/usr/lib/python3/dist-packages/visidata/loaders/sqlite.py", line 24, in reload β
self.columns = self.getColumns(tblname) β
File "/usr/lib/python3/dist-packages/visidata/loaders/sqlite.py", line 33, in getColumns β
for i, r in enumerate(self.conn.execute('PRAGMA TABLE_INFO(%s)' % tableName)): β
sqlite3.OperationalError: near "select": syntax error β
|
sqlite3.OperationalError
|
def __init__(self, *objs):
self.locals = {}
self.objs = list(objs) + [self.locals]
|
def __init__(self, *objs):
self.objs = objs
|
https://github.com/saulpw/visidata/issues/251
|
$ vd --debug -b -p newCol.vd
Think about what you're doing
opening newCol as vd
"."
opening . as dir
"1"
c=addColumn(SettableColumn("", width=options.default_width), cursorColIndex+1); draw(vd.scr); cursorVisibleColIndex=visibleCols.index(c); c.name=editCell(cursorVisibleColIndex, -1); c.width=None
AttributeError: 'NoneType' object has no attribute 'erase'
AttributeError: 'NoneType' object has no attribute 'erase'
Traceback (most recent call last):
File "/usr/local/bin/vd", line 4, in <module>
__import__('pkg_resources').run_script('visidata==1.6.dev0', 'vd')
File "/home/cwarden/.local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 664, in run_script
self.require(requires)[0].run_script(script_name, ns)
File "/home/cwarden/.local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 1451, in run_script
exec(script_code, namespace, namespace)
File "/usr/local/lib/python3.6/dist-packages/visidata-1.6.dev0-py3.6.egg/EGG-INFO/scripts/vd", line 169, in <module>
File "/usr/local/lib/python3.6/dist-packages/visidata-1.6.dev0-py3.6.egg/EGG-INFO/scripts/vd", line 152, in main
File "/usr/local/lib/python3.6/dist-packages/visidata-1.6.dev0-py3.6.egg/visidata/cmdlog.py", line 289, in replay_sync
File "/usr/local/lib/python3.6/dist-packages/visidata-1.6.dev0-py3.6.egg/visidata/vdtui/__init__.py", line 455, in exceptionCaught
File "/usr/local/lib/python3.6/dist-packages/visidata-1.6.dev0-py3.6.egg/visidata/cmdlog.py", line 284, in replay_sync
File "/usr/local/lib/python3.6/dist-packages/visidata-1.6.dev0-py3.6.egg/visidata/cmdlog.py", line 264, in replayOne
File "/usr/local/lib/python3.6/dist-packages/visidata-1.6.dev0-py3.6.egg/visidata/vdtui/__init__.py", line 1132, in exec_command
File "/usr/local/lib/python3.6/dist-packages/visidata-1.6.dev0-py3.6.egg/visidata/vdtui/__init__.py", line 1126, in exec_command
File "<string>", line 1, in <module>
File "/usr/local/lib/python3.6/dist-packages/visidata-1.6.dev0-py3.6.egg/visidata/vdtui/_sheet.py", line 566, in draw
AttributeError: 'NoneType' object has no attribute 'erase'
|
AttributeError
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.