Improved detection of a package type from the tarball archive // Resolve #3828

This commit is contained in:
Ivan Kravets
2022-04-08 13:58:40 +03:00
parent 9097d455db
commit 1269ce064a
4 changed files with 11 additions and 7 deletions

View File

@ -32,6 +32,7 @@ PlatformIO Core 5
- Added support for `symbolic links <https://docs.platformio.org/en/latest/core/userguide/pkg/cmd_install.html#local-folder>`__ allowing pointing the local source folder to the Package Manager (`issue #3348 <https://github.com/platformio/platformio-core/issues/3348>`_) - Added support for `symbolic links <https://docs.platformio.org/en/latest/core/userguide/pkg/cmd_install.html#local-folder>`__ allowing pointing the local source folder to the Package Manager (`issue #3348 <https://github.com/platformio/platformio-core/issues/3348>`_)
- Automatically install dependencies of the local (private) project libraries (`issue #2910 <https://github.com/platformio/platformio-core/issues/2910>`_) - Automatically install dependencies of the local (private) project libraries (`issue #2910 <https://github.com/platformio/platformio-core/issues/2910>`_)
- Improved detection of a package type from the tarball archive (`issue #3828 <https://github.com/platformio/platformio-core/issues/3828>`_)
- Ignore files according to the patterns declared in ".gitignore" when using the `pio package pack <https://docs.platformio.org/en/latest/core/userguide/pkg/cmd_pack.html>`__ command (`issue #4188 <https://github.com/platformio/platformio-core/issues/4188>`_) - Ignore files according to the patterns declared in ".gitignore" when using the `pio package pack <https://docs.platformio.org/en/latest/core/userguide/pkg/cmd_pack.html>`__ command (`issue #4188 <https://github.com/platformio/platformio-core/issues/4188>`_)
- Dropped automatic updates of global libraries and development platforms (`issue #4179 <https://github.com/platformio/platformio-core/issues/4179>`_) - Dropped automatic updates of global libraries and development platforms (`issue #4179 <https://github.com/platformio/platformio-core/issues/4179>`_)
- Dropped support for the "pythonPackages" field in "platform.json" manifest in favor of `Extra Python Dependencies <https://docs.platformio.org/en/latest/scripting/examples/extra_python_packages.html>`__ - Dropped support for the "pythonPackages" field in "platform.json" manifest in favor of `Extra Python Dependencies <https://docs.platformio.org/en/latest/scripting/examples/extra_python_packages.html>`__

2
docs

Submodule docs updated: f834c85d59...f543ff06f0

View File

@ -52,6 +52,11 @@ def validate_datetime(ctx, param, value): # pylint: disable=unused-argument
help="PIO Account username (can be organization username). " help="PIO Account username (can be organization username). "
"Default is set to a username of the authorized PIO Account", "Default is set to a username of the authorized PIO Account",
) )
@click.option(
"--type", "type_",
type=click.Choice(list(PackageType.items().values())),
help="Custom package type",
)
@click.option( @click.option(
"--released-at", "--released-at",
callback=validate_datetime, callback=validate_datetime,
@ -69,13 +74,13 @@ def validate_datetime(ctx, param, value): # pylint: disable=unused-argument
help="Do not show interactive prompt", help="Do not show interactive prompt",
) )
def package_publish_cmd( # pylint: disable=too-many-arguments, too-many-locals def package_publish_cmd( # pylint: disable=too-many-arguments, too-many-locals
package, owner, released_at, private, notify, non_interactive package, owner, type_, released_at, private, notify, non_interactive
): ):
click.secho("Preparing a package...", fg="cyan") click.secho("Preparing a package...", fg="cyan")
owner = owner or AccountClient().get_logged_username() owner = owner or AccountClient().get_logged_username()
do_not_pack = not os.path.isdir(package) and isinstance( do_not_pack = not os.path.isdir(package) and isinstance(
FileUnpacker.new_archiver(package), TARArchiver FileUnpacker.new_archiver(package), TARArchiver
) ) and PackageType.from_archive(package)
archive_path = None archive_path = None
with tempfile.TemporaryDirectory() as tmp_dir: # pylint: disable=no-member with tempfile.TemporaryDirectory() as tmp_dir: # pylint: disable=no-member
# publish .tar.gz instantly without repacking # publish .tar.gz instantly without repacking
@ -86,7 +91,7 @@ def package_publish_cmd( # pylint: disable=too-many-arguments, too-many-locals
p = PackagePacker(package) p = PackagePacker(package)
archive_path = p.pack() archive_path = p.pack()
type_ = PackageType.from_archive(archive_path) type_ = type_ or PackageType.from_archive(archive_path)
manifest = ManifestSchema().load_manifest( manifest = ManifestSchema().load_manifest(
ManifestParserFactory.new_from_archive(archive_path).as_dict() ManifestParserFactory.new_from_archive(archive_path).as_dict()
) )

View File

@ -275,9 +275,7 @@ def test_remove_project_unused_libdeps(
# add new deps # add new deps
lib_deps = config.get("env:baremetal", "lib_deps") lib_deps = config.get("env:baremetal", "lib_deps")
config.set( config.set("env:baremetal", "lib_deps", lib_deps + ["bblanchon/ArduinoJson@^5"])
"env:baremetal", "lib_deps", lib_deps + ["bblanchon/ArduinoJson@^5"]
)
config.save() config.save()
result = clirunner.invoke( result = clirunner.invoke(
package_install_cmd, package_install_cmd,