Remove unused Python imports

This commit is contained in:
Ivan Kravets
2019-05-27 22:25:22 +03:00
parent 3adcf66453
commit 3df01405a1
22 changed files with 111 additions and 131 deletions

View File

@ -27,7 +27,8 @@ import requests
from platformio import exception, lockfile, util
from platformio.compat import PY2, WINDOWS
from platformio.proc import is_ci
from platformio.project.helpers import get_project_core_dir
from platformio.project.helpers import (get_project_cache_dir,
get_project_core_dir)
def projects_dir_validate(projects_dir):
@ -139,7 +140,7 @@ class ContentCache(object):
self._db_path = None
self._lockfile = None
self.cache_dir = cache_dir or util.get_cache_dir()
self.cache_dir = cache_dir or get_project_cache_dir()
self._db_path = join(self.cache_dir, "db.data")
def __enter__(self):

View File

@ -20,10 +20,9 @@ from os.path import abspath, isfile, join
from SCons.Defaults import processDefines # pylint: disable=import-error
from platformio import util
from platformio.compat import glob_escape
from platformio.managers.core import get_core_package_dir
from platformio.proc import exec_command
from platformio.proc import exec_command, where_is_program
def _dump_includes(env, projenv):
@ -151,11 +150,11 @@ def DumpIDEData(env, projenv):
"cxx_flags":
env.subst(LINTCXXCOM),
"cc_path":
util.where_is_program(env.subst("$CC"), env.subst("${ENV['PATH']}")),
where_is_program(env.subst("$CC"), env.subst("${ENV['PATH']}")),
"cxx_path":
util.where_is_program(env.subst("$CXX"), env.subst("${ENV['PATH']}")),
where_is_program(env.subst("$CXX"), env.subst("${ENV['PATH']}")),
"gdb_path":
util.where_is_program(env.subst("$GDB"), env.subst("${ENV['PATH']}")),
where_is_program(env.subst("$GDB"), env.subst("${ENV['PATH']}")),
"prog_path":
env.subst("$PROG_PATH"),
"flash_extra_images": [{

View File

@ -30,6 +30,7 @@ from platformio.commands.debug import helpers, initcfgs
from platformio.commands.debug.process import BaseProcess
from platformio.commands.debug.server import DebugServer
from platformio.compat import PY2
from platformio.project.helpers import get_project_cache_dir
from platformio.telemetry import MeasurementProtocol
LOG_FILE = None
@ -49,10 +50,10 @@ class GDBClient(BaseProcess): # pylint: disable=too-many-instance-attributes
self._debug_server = DebugServer(debug_options, env_options)
self._session_id = None
if not isdir(util.get_cache_dir()):
os.makedirs(util.get_cache_dir())
if not isdir(get_project_cache_dir()):
os.makedirs(get_project_cache_dir())
self._gdbsrc_dir = mkdtemp(
dir=util.get_cache_dir(), prefix=".piodebug-")
dir=get_project_cache_dir(), prefix=".piodebug-")
self._target_is_run = False
self._last_server_activity = 0

View File

@ -24,6 +24,7 @@ from platformio import exception, util
from platformio.commands.debug import helpers
from platformio.managers.core import inject_contrib_pysite
from platformio.project.config import ProjectConfig
from platformio.project.helpers import is_platformio_project
@click.command(
@ -66,7 +67,7 @@ def cli(ctx, project_dir, project_conf, environment, verbose, interface,
('~"%s\\n"' if helpers.is_mi_mode(__unprocessed) else "%s") %
line)
if not util.is_platformio_project(project_dir) and os.getenv("CWD"):
if not is_platformio_project(project_dir) and os.getenv("CWD"):
project_dir = os.getenv("CWD")
with util.cd(project_dir):

View File

@ -17,9 +17,9 @@ import os
import click
from twisted.internet import protocol # pylint: disable=import-error
from platformio import util
from platformio.commands.debug import helpers
from platformio.compat import string_types
from platformio.project.helpers import get_project_core_dir
LOG_FILE = None
@ -29,7 +29,8 @@ class BaseProcess(protocol.ProcessProtocol, object):
STDOUT_CHUNK_SIZE = 2048
COMMON_PATTERNS = {
"PLATFORMIO_HOME_DIR": helpers.escape_path(util.get_home_dir()),
"PLATFORMIO_HOME_DIR": helpers.escape_path(get_project_core_dir()),
"PLATFORMIO_CORE_DIR": helpers.escape_path(get_project_core_dir()),
"PYTHONEXE": os.getenv("PYTHONEXEPATH", "")
}

View File

@ -20,6 +20,7 @@ from twisted.internet import reactor # pylint: disable=import-error
from platformio import exception, util
from platformio.commands.debug import helpers
from platformio.commands.debug.process import BaseProcess
from platformio.proc import where_is_program
class DebugServer(BaseProcess):
@ -47,7 +48,7 @@ class DebugServer(BaseProcess):
server_executable = server_executable + ".exe"
if not isfile(server_executable):
server_executable = util.where_is_program(server_executable)
server_executable = where_is_program(server_executable)
if not isfile(server_executable):
raise exception.DebugInvalidOptions(
"\nCould not launch Debug Server '%s'. Please check that it "

View File

@ -23,6 +23,7 @@ from twisted.internet import reactor # pylint: disable=import-error
from twisted.internet import threads # pylint: disable=import-error
from platformio import util
from platformio.proc import where_is_program
class AsyncSession(requests.Session):
@ -49,7 +50,7 @@ def requests_session():
@util.memoized()
def get_core_fullpath():
return util.where_is_program(
return where_is_program(
"platformio" + (".exe" if "windows" in util.get_systype() else ""))

View File

@ -19,11 +19,13 @@ from os.path import expanduser, isfile, join
from platformio import __version__, app, exception, util
from platformio.compat import path_to_unicode
from platformio.project.helpers import (get_project_core_dir,
is_platformio_project)
class AppRPC(object):
APPSTATE_PATH = join(util.get_home_dir(), "homestate.json")
APPSTATE_PATH = join(get_project_core_dir(), "homestate.json")
@staticmethod
def load_state():
@ -67,7 +69,7 @@ class AppRPC(object):
# skip non-existing recent projects
storage['recentProjects'] = [
p for p in storage.get("recentProjects", [])
if util.is_platformio_project(p)
if is_platformio_project(p)
]
state['storage'] = storage

View File

@ -29,7 +29,8 @@ from platformio.compat import get_filesystem_encoding
from platformio.ide.projectgenerator import ProjectGenerator
from platformio.managers.platform import PlatformManager
from platformio.project.config import ProjectConfig
from platformio.project.helpers import get_project_libdeps_dir
from platformio.project.helpers import (
get_project_libdeps_dir, get_project_src_dir, is_platformio_project)
class ProjectRPC(object):
@ -46,8 +47,7 @@ class ProjectRPC(object):
if config.has_section("platformio") and \
config.has_option("platformio", "lib_extra_dirs"):
data['libExtraDirs'].extend(
util.parse_conf_multi_values(
config.get("platformio", "lib_extra_dirs")))
config.getlist("platformio", "lib_extra_dirs"))
for section in config.sections():
if not section.startswith("env:"):
@ -57,8 +57,7 @@ class ProjectRPC(object):
data['boards'].append(config.get(section, "board"))
if config.has_option(section, "lib_extra_dirs"):
data['libExtraDirs'].extend(
util.parse_conf_multi_values(
config.get(section, "lib_extra_dirs")))
config.getlist(section, "lib_extra_dirs"))
# skip non existing folders and resolve full path
for key in ("envLibdepsDirs", "libExtraDirs"):
@ -165,7 +164,7 @@ class ProjectRPC(object):
if not main_content:
return project_dir
with util.cd(project_dir):
src_dir = util.get_projectsrc_dir()
src_dir = get_project_src_dir()
main_path = join(src_dir, "main.cpp")
if isfile(main_path):
return project_dir
@ -177,7 +176,7 @@ class ProjectRPC(object):
def import_arduino(self, board, use_arduino_libs, arduino_project_dir):
# don't import PIO Project
if util.is_platformio_project(arduino_project_dir):
if is_platformio_project(arduino_project_dir):
return arduino_project_dir
is_arduino_project = any([
@ -214,7 +213,7 @@ class ProjectRPC(object):
@staticmethod
def _finalize_arduino_import(_, project_dir, arduino_project_dir):
with util.cd(project_dir):
src_dir = util.get_projectsrc_dir()
src_dir = get_project_src_dir()
if isdir(src_dir):
util.rmtree_(src_dir)
shutil.copytree(
@ -261,7 +260,7 @@ class ProjectRPC(object):
@staticmethod
def import_pio(project_dir):
if not project_dir or not util.is_platformio_project(project_dir):
if not project_dir or not is_platformio_project(project_dir):
raise jsonrpc.exceptions.JSONRPCDispatchException(
code=4001,
message="Not an PlatformIO project: %s" % project_dir)

View File

@ -349,14 +349,3 @@ def print_summary(results, start_time):
(click.style("SUCCESS", fg="green", bold=True) if successed else
click.style("ERROR", fg="red", bold=True)), time() - start_time),
is_error=not successed)
def check_project_envs(config, environments=None): # FIXME: Remove
if not config.sections():
raise exception.ProjectEnvsNotAvailable()
known = set(s[4:] for s in config.sections() if s.startswith("env:"))
unknown = set(environments or []) - known
if unknown:
raise exception.UnknownEnvNames(", ".join(unknown), ", ".join(known))
return True

View File

@ -26,6 +26,7 @@ from platformio.commands.run import print_header
from platformio.commands.test.embedded import EmbeddedTestProcessor
from platformio.commands.test.native import NativeTestProcessor
from platformio.project.config import ProjectConfig
from platformio.project.helpers import get_project_test_dir
@click.command("test", short_help="Unit Testing")
@ -84,7 +85,7 @@ def cli( # pylint: disable=redefined-builtin
project_conf, without_building, without_uploading, without_testing,
no_reset, monitor_rts, monitor_dtr, verbose):
with util.cd(project_dir):
test_dir = util.get_projecttest_dir()
test_dir = get_project_test_dir()
if not isdir(test_dir):
raise exception.TestDirNotExists(test_dir)
test_names = get_test_names(test_dir)
@ -147,10 +148,13 @@ def cli( # pylint: disable=redefined-builtin
if without_testing:
return
click.echo()
print_header("[%s]" % click.style("TEST SUMMARY"))
passed = True
testname_max_len = max([len(r[1]) for r in results])
envname_max_len = max([len(click.style(r[2], fg="cyan")) for r in results])
print_header("[%s]" % click.style("TEST SUMMARY"))
click.echo()
for result in results:
status, testname, envname = result
status_str = click.style("PASSED", fg="green")
@ -161,9 +165,9 @@ def cli( # pylint: disable=redefined-builtin
status_str = click.style("IGNORED", fg="yellow")
click.echo(
"test/%s/env:%s\t[%s]" % (click.style(testname, fg="yellow"),
click.style(envname, fg="cyan"),
status_str),
("test/{:<%d} > {:<%d}\t[{}]" %
(testname_max_len, envname_max_len)).format(
testname, click.style(envname, fg="cyan"), status_str),
err=status is False)
print_header(

View File

@ -16,6 +16,8 @@ from os.path import join
from platformio import util
from platformio.commands.test.processor import TestProcessorBase
from platformio.proc import LineBufferedAsyncPipe
from platformio.project.helpers import get_project_build_dir
class NativeTestProcessor(TestProcessorBase):
@ -31,9 +33,10 @@ class NativeTestProcessor(TestProcessorBase):
def run(self):
with util.cd(self.options['project_dir']):
build_dir = util.get_projectbuild_dir()
result = util.exec_command([join(build_dir, self.env_name, "program")],
stdout=util.AsyncPipe(self.on_run_out),
stderr=util.AsyncPipe(self.on_run_out))
build_dir = get_project_build_dir()
result = util.exec_command(
[join(build_dir, self.env_name, "program")],
stdout=LineBufferedAsyncPipe(self.on_run_out),
stderr=LineBufferedAsyncPipe(self.on_run_out))
assert "returncode" in result
return result['returncode'] == 0 and not self._run_failed

View File

@ -19,9 +19,10 @@ from string import Template
import click
from platformio import exception, util
from platformio import exception
from platformio.commands.run import cli as cmd_run
from platformio.commands.run import print_header
from platformio.project.helpers import get_project_test_dir
TRANSPORT_OPTIONS = {
"arduino": {
@ -113,7 +114,7 @@ class TestProcessorBase(object):
def build_or_upload(self, target):
if not self._outputcpp_generated:
self.generate_outputcpp(util.get_projecttest_dir())
self.generate_outputcpp(get_project_test_dir())
self._outputcpp_generated = True
if self.test_name != "*":
@ -138,6 +139,7 @@ class TestProcessorBase(object):
raise NotImplementedError
def on_run_out(self, line):
line = line.strip()
if line.endswith(":PASS"):
click.echo(
"%s\t[%s]" % (line[:-5], click.style("PASSED", fg="green")))

View File

@ -23,6 +23,7 @@ from platformio import VERSION, __version__, exception, util
from platformio.compat import WINDOWS
from platformio.managers.core import shutdown_piohome_servers
from platformio.proc import exec_command, get_pythonexe_path
from platformio.project.helpers import get_project_cache_dir
@click.command(
@ -95,7 +96,7 @@ def get_pip_package(to_develop):
return "platformio"
dl_url = ("https://github.com/platformio/"
"platformio-core/archive/develop.zip")
cache_dir = util.get_cache_dir()
cache_dir = get_project_cache_dir()
if not os.path.isdir(cache_dir):
os.makedirs(cache_dir)
pkg_name = os.path.join(cache_dir, "piocoredevelop.zip")

View File

@ -174,7 +174,7 @@ class ProjectEnvsNotAvailable(PlatformIOProjectException):
MESSAGE = "Please setup environments in `platformio.ini` file"
class UnknownEnvNames(PlatformIOProjectException): # FIXME: UnknownProjectEnvs
class UnknownEnvNames(PlatformIOProjectException):
MESSAGE = "Unknown environment names '{0}'. Valid names are '{1}'"

View File

@ -24,6 +24,7 @@ from click.testing import CliRunner
from platformio import exception, util
from platformio.commands.run import cli as cmd_run
from platformio.compat import PY2, WINDOWS, get_file_contents
from platformio.proc import where_is_program
from platformio.project.config import ProjectConfig
from platformio.project.helpers import (
get_project_lib_dir, get_project_libdeps_dir, get_project_src_dir)
@ -149,7 +150,7 @@ class ProjectGenerator(object):
"systype": util.get_systype(),
"platformio_path": self._fix_os_path(
sys.argv[0] if isfile(sys.argv[0])
else util.where_is_program("platformio")),
else where_is_program("platformio")),
"env_pathsep": os.pathsep,
"env_path": self._fix_os_path(os.getenv("PATH"))
}) # yapf: disable

View File

@ -30,7 +30,7 @@ CORE_PACKAGES = {
"contrib-piohome": "^2.1.0",
"contrib-pysite":
"~2.%d%d.190418" % (sys.version_info[0], sys.version_info[1]),
"tool-pioplus": "^2.3.0",
"tool-pioplus": "^2.4.0",
"tool-unity": "~1.20403.0",
"tool-scons": "~2.20501.7" if PY2 else "~3.30005.0"
}

View File

@ -96,8 +96,7 @@ class LineBufferedAsyncPipe(AsyncPipeBase):
def do_reading(self):
for line in iter(self._pipe_reader.readline, ""):
self._buffer += line
# FIXME: Remove striping
self.line_callback(line.strip())
self.line_callback(line)
self._pipe_reader.close()

View File

@ -12,9 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
# FIXME: Remove line below before 4.0 release
# pylint: disable=unused-import
import json
import os
import platform
@ -25,7 +22,7 @@ import sys
import time
from functools import wraps
from glob import glob
from os.path import abspath, basename, dirname, isdir, isfile, join
from os.path import abspath, basename, dirname, isfile, join
from shutil import rmtree
import click
@ -33,31 +30,8 @@ import requests
from platformio import __apiurl__, __version__, exception
from platformio.commands import PlatformioCLI
from platformio.compat import PY2, WINDOWS, get_file_contents, path_to_unicode
from platformio.proc import LineBufferedAsyncPipe as AsyncPipe
from platformio.proc import exec_command, is_ci, where_is_program
from platformio.project.config import ProjectConfig
from platformio.project.helpers import \
get_project_boards_dir as get_projectboards_dir
from platformio.project.helpers import \
get_project_build_dir as get_projectbuild_dir
from platformio.project.helpers import get_project_cache_dir as get_cache_dir
from platformio.project.helpers import get_project_core_dir as get_home_dir
from platformio.project.helpers import \
get_project_data_dir as get_projectdata_dir
from platformio.project.helpers import get_project_dir
from platformio.project.helpers import \
get_project_include_dir as get_projectinclude_dir
from platformio.project.helpers import \
get_project_lib_dir as get_projectlib_dir
from platformio.project.helpers import \
get_project_libdeps_dir as get_projectlibdeps_dir
from platformio.project.helpers import get_project_optional_dir
from platformio.project.helpers import \
get_project_src_dir as get_projectsrc_dir
from platformio.project.helpers import \
get_project_test_dir as get_projecttest_dir
from platformio.project.helpers import is_platformio_project
from platformio.compat import PY2, WINDOWS, get_file_contents
from platformio.proc import exec_command, is_ci
class cd(object):
@ -160,19 +134,6 @@ def get_source_dir():
return dirname(curpath)
def load_project_config(path=None): # FIXME: Remove
if not path or isdir(path):
path = join(path or get_project_dir(), "platformio.ini")
if not isfile(path):
raise exception.NotPlatformIOProject(
dirname(path) if path.endswith("platformio.ini") else path)
return ProjectConfig(path)
def parse_conf_multi_values(items): # FIXME: Remove
return ProjectConfig.parse_multi_values(items)
def change_filemtime(path, mtime):
os.utime(path, (mtime, mtime))

View File

@ -19,6 +19,7 @@ from os.path import getsize, isdir, isfile, join
from platformio import exception, util
from platformio.commands.boards import cli as cmd_boards
from platformio.commands.init import cli as cmd_init
from platformio.project.config import ProjectConfig
def validate_pioproject(pioproject_dir):
@ -50,7 +51,8 @@ def test_init_duplicated_boards(clirunner, validate_cliresult, tmpdir):
result = clirunner.invoke(cmd_init, ["-b", "uno", "-b", "uno"])
validate_cliresult(result)
validate_pioproject(str(tmpdir))
config = util.load_project_config()
config = ProjectConfig(join(getcwd(), "platformio.ini"))
config.validate()
assert set(config.sections()) == set(["env:uno"])
@ -105,7 +107,8 @@ def test_init_special_board(clirunner, validate_cliresult):
validate_cliresult(result)
boards = json.loads(result.output)
config = util.load_project_config()
config = ProjectConfig(join(getcwd(), "platformio.ini"))
config.validate()
expected_result = [("platform", str(boards[0]['platform'])),
("framework",
str(boards[0]['frameworks'][0])), ("board", "uno")]
@ -121,7 +124,8 @@ def test_init_enable_auto_uploading(clirunner, validate_cliresult):
cmd_init, ["-b", "uno", "--project-option", "targets=upload"])
validate_cliresult(result)
validate_pioproject(getcwd())
config = util.load_project_config()
config = ProjectConfig(join(getcwd(), "platformio.ini"))
config.validate()
expected_result = [("platform", "atmelavr"), ("framework", "arduino"),
("board", "uno"), ("targets", "upload")]
assert config.has_section("env:uno")
@ -135,7 +139,8 @@ def test_init_custom_framework(clirunner, validate_cliresult):
cmd_init, ["-b", "teensy31", "--project-option", "framework=mbed"])
validate_cliresult(result)
validate_pioproject(getcwd())
config = util.load_project_config()
config = ProjectConfig(join(getcwd(), "platformio.ini"))
config.validate()
expected_result = [("platform", "teensy"), ("framework", "mbed"),
("board", "teensy31")]
assert config.has_section("env:teensy31")

View File

@ -21,6 +21,7 @@ import pytest
from platformio import util
from platformio.managers.platform import PlatformFactory, PlatformManager
from platformio.project.config import ProjectConfig
def pytest_generate_tests(metafunc):
@ -73,11 +74,7 @@ def test_run(pioproject_dir):
if isdir(build_dir):
util.rmtree_(build_dir)
env_names = []
for section in util.load_project_config().sections():
if section.startswith("env:"):
env_names.append(section[4:])
env_names = ProjectConfig(join(pioproject_dir, "platformio.ini")).envs()
result = util.exec_command(
["platformio", "run", "-e",
random.choice(env_names)])

View File

@ -15,8 +15,8 @@
import json
from os.path import join
from platformio import util
from platformio.managers.package import PackageManager
from platformio.project.helpers import get_project_core_dir
def test_pkg_input_parser():
@ -28,16 +28,16 @@ def test_pkg_input_parser():
["id=13", ("id=13", None, None)],
["id=13@~1.2.3", ("id=13", "~1.2.3", None)],
[
util.get_home_dir(),
(".platformio", None, "file://" + util.get_home_dir())
get_project_core_dir(),
(".platformio", None, "file://" + get_project_core_dir())
],
[
"LocalName=" + util.get_home_dir(),
("LocalName", None, "file://" + util.get_home_dir())
"LocalName=" + get_project_core_dir(),
("LocalName", None, "file://" + get_project_core_dir())
],
[
"LocalName=%s@>2.3.0" % util.get_home_dir(),
("LocalName", ">2.3.0", "file://" + util.get_home_dir())
"LocalName=%s@>2.3.0" % get_project_core_dir(),
("LocalName", ">2.3.0", "file://" + get_project_core_dir())
],
[
"https://github.com/user/package.git",
@ -130,7 +130,8 @@ def test_pkg_input_parser():
],
[
"LocalName=git@github.com:user/package.git#v1.2.0@~1.2.0",
("LocalName", "~1.2.0", "git+git@github.com:user/package.git#v1.2.0")
("LocalName", "~1.2.0",
"git+git@github.com:user/package.git#v1.2.0")
],
[
"git+ssh://git@gitlab.private-server.com/user/package#1.2.0",
@ -164,15 +165,18 @@ def test_install_packages(isolated_pio_home, tmpdir):
dict(id=1, name="name_1", version="1.2"),
dict(id=1, name="name_1", version="1.0.0"),
dict(name="name_2", version="1.0.0"),
dict(name="name_2", version="2.0.0",
dict(name="name_2",
version="2.0.0",
__src_url="git+https://github.com"),
dict(name="name_2", version="3.0.0",
dict(name="name_2",
version="3.0.0",
__src_url="git+https://github2.com"),
dict(name="name_2", version="4.0.0",
dict(name="name_2",
version="4.0.0",
__src_url="git+https://github2.com")
]
pm = PackageManager(join(util.get_home_dir(), "packages"))
pm = PackageManager(join(get_project_core_dir(), "packages"))
for package in packages:
tmp_dir = tmpdir.mkdir("tmp-package")
tmp_dir.join("package.json").write(json.dumps(package))
@ -182,36 +186,44 @@ def test_install_packages(isolated_pio_home, tmpdir):
assert len(pm.get_installed()) == len(packages) - 1
pkg_dirnames = [
'name_1_ID1', 'name_1_ID1@1.0.0', 'name_1_ID1@1.2',
'name_1_ID1@2.0.0', 'name_1_ID1@shasum', 'name_2',
'name_1_ID1', 'name_1_ID1@1.0.0', 'name_1_ID1@1.2', 'name_1_ID1@2.0.0',
'name_1_ID1@shasum', 'name_2',
'name_2@src-177cbce1f0705580d17790fda1cc2ef5',
'name_2@src-f863b537ab00f4c7b5011fc44b120e1f'
]
assert set([p.basename for p in isolated_pio_home.join(
"packages").listdir()]) == set(pkg_dirnames)
assert set([
p.basename for p in isolated_pio_home.join("packages").listdir()
]) == set(pkg_dirnames)
def test_get_package():
tests = [
[("unknown", ), None],
[("1", ), None],
[("id=1", "shasum"), dict(id=1, name="name_1", version="shasum")],
[("id=1", "*"), dict(id=1, name="name_1", version="2.1.0")],
[("id=1", "^1"), dict(id=1, name="name_1", version="1.2")],
[("id=1", "^1"), dict(id=1, name="name_1", version="1.2")],
[("name_1", "<2"), dict(id=1, name="name_1", version="1.2")],
[("id=1", "shasum"),
dict(id=1, name="name_1", version="shasum")],
[("id=1", "*"),
dict(id=1, name="name_1", version="2.1.0")],
[("id=1", "^1"),
dict(id=1, name="name_1", version="1.2")],
[("id=1", "^1"),
dict(id=1, name="name_1", version="1.2")],
[("name_1", "<2"),
dict(id=1, name="name_1", version="1.2")],
[("name_1", ">2"), None],
[("name_1", "2-0-0"), None],
[("name_2", ), dict(name="name_2", version="4.0.0")],
[("url_has_higher_priority", None, "git+https://github.com"),
dict(name="name_2", version="2.0.0",
dict(name="name_2",
version="2.0.0",
__src_url="git+https://github.com")],
[("name_2", None, "git+https://github.com"),
dict(name="name_2", version="2.0.0",
dict(name="name_2",
version="2.0.0",
__src_url="git+https://github.com")],
]
pm = PackageManager(join(util.get_home_dir(), "packages"))
pm = PackageManager(join(get_project_core_dir(), "packages"))
for test in tests:
manifest = pm.get_package(*test[0])
if test[1] is None: