Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
arduino-cli
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Operations
Operations
Metrics
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
arduino-cli
Commits
d1163cbe
Unverified
Commit
d1163cbe
authored
Jan 29, 2021
by
Silvano Cerza
Committed by
GitHub
Jan 29, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix lib install --zip-path not preserving folders structure (#1158)
parent
1aa53c88
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
10 deletions
+16
-10
arduino/libraries/librariesmanager/install.go
arduino/libraries/librariesmanager/install.go
+2
-10
test/test_lib.py
test/test_lib.py
+14
-0
No files found.
arduino/libraries/librariesmanager/install.go
View file @
d1163cbe
...
...
@@ -144,17 +144,9 @@ func (lm *LibrariesManager) InstallZipLib(ctx context.Context, archivePath strin
WithField
(
"zip file"
,
archivePath
)
.
Trace
(
"Installing library"
)
files
,
err
:=
tmpDir
.
Join
(
libraryName
)
.
ReadDirRecursive
()
files
.
FilterOutDirs
()
for
_
,
f
:=
range
files
{
finalPath
:=
installPath
.
Join
(
f
.
Base
())
if
err
:=
finalPath
.
Parent
()
.
MkdirAll
();
err
!=
nil
{
return
fmt
.
Errorf
(
"creating directory: %w"
,
err
)
}
if
err
:=
f
.
CopyTo
(
finalPath
);
err
!=
nil
{
if
err
:=
tmpDir
.
Join
(
libraryName
)
.
CopyDirTo
(
installPath
);
err
!=
nil
{
return
fmt
.
Errorf
(
"copying library: %w"
,
err
)
}
}
return
nil
}
...
...
test/test_lib.py
View file @
d1163cbe
...
...
@@ -297,12 +297,26 @@ def test_install_with_zip_path(run_command, data_dir, downloads_dir):
# Verifies library is installed in expected path
assert
lib_install_dir
.
exists
()
files
=
list
(
lib_install_dir
.
glob
(
"**/*"
))
assert
lib_install_dir
/
"examples"
/
"SimpleAudioPlayerZero"
/
"SimpleAudioPlayerZero.ino"
in
files
assert
lib_install_dir
/
"src"
/
"AudioZero.h"
in
files
assert
lib_install_dir
/
"src"
/
"AudioZero.cpp"
in
files
assert
lib_install_dir
/
"keywords.txt"
in
files
assert
lib_install_dir
/
"library.properties"
in
files
assert
lib_install_dir
/
"README.adoc"
in
files
# Reinstall library
assert
run_command
(
f"lib install --zip-path
{
zip_path
}
"
)
# Verifies library remains installed
assert
lib_install_dir
.
exists
()
files
=
list
(
lib_install_dir
.
glob
(
"**/*"
))
assert
lib_install_dir
/
"examples"
/
"SimpleAudioPlayerZero"
/
"SimpleAudioPlayerZero.ino"
in
files
assert
lib_install_dir
/
"src"
/
"AudioZero.h"
in
files
assert
lib_install_dir
/
"src"
/
"AudioZero.cpp"
in
files
assert
lib_install_dir
/
"keywords.txt"
in
files
assert
lib_install_dir
/
"library.properties"
in
files
assert
lib_install_dir
/
"README.adoc"
in
files
def
test_update_index
(
run_command
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment