mirror of
https://github.com/platformio/platformio-core.git
synced 2025-07-30 18:17:13 +02:00
Minor improvements for symlink support // Issue #3348
This commit is contained in:
@ -15,7 +15,6 @@
|
||||
import json
|
||||
import os
|
||||
|
||||
from platformio import fs
|
||||
from platformio.package.exception import PackageException
|
||||
from platformio.package.meta import PackageItem, PackageSpec
|
||||
|
||||
@ -33,9 +32,10 @@ class PackageManagerSymlinkMixin(object):
|
||||
data = json.load(fp)
|
||||
spec = PackageSpec(**data["spec"])
|
||||
assert spec.symlink
|
||||
with fs.cd(data["cwd"]):
|
||||
pkg_dir = os.path.realpath(spec.uri[10:])
|
||||
return (pkg_dir if os.path.isdir(pkg_dir) else None, spec)
|
||||
pkg_dir = spec.uri[10:]
|
||||
if not os.path.isabs(pkg_dir):
|
||||
pkg_dir = os.path.normpath(os.path.join(data["cwd"], pkg_dir))
|
||||
return (pkg_dir if os.path.isdir(pkg_dir) else None, spec)
|
||||
|
||||
def get_symlinked_package(self, path):
|
||||
pkg_dir, spec = self.resolve_symlink(path)
|
||||
|
@ -323,7 +323,9 @@ def test_symlink(tmp_path: Path):
|
||||
assert ["External", "Installed"] == [
|
||||
pkg.metadata.name for pkg in lm.get_installed()
|
||||
]
|
||||
assert lm.get_package("External").metadata.spec.uri.startswith("symlink://")
|
||||
pkg = lm.get_package("External")
|
||||
assert Path(pkg.path) == external_pkg_dir
|
||||
assert pkg.metadata.spec.uri.startswith("symlink://")
|
||||
assert lm.get_package(spec).metadata.spec.uri.startswith("symlink://")
|
||||
|
||||
# try to update
|
||||
|
@ -216,9 +216,8 @@ int main() {
|
||||
"""
|
||||
[env:native]
|
||||
platform = native
|
||||
lib_deps = symlink://%s
|
||||
lib_deps = symlink://../External
|
||||
"""
|
||||
% str(external_pkg_dir)
|
||||
)
|
||||
result = clirunner.invoke(cmd_run, ["--project-dir", str(project_dir), "--verbose"])
|
||||
validate_cliresult(result)
|
||||
|
Reference in New Issue
Block a user