Skip to content

Commit

Permalink
Improved detection of a package type from the tarball archive // Resolve
Browse files Browse the repository at this point in the history
  • Loading branch information
ivankravets committed Apr 8, 2022
1 parent 9097d45 commit 1269ce0
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
1 change: 1 addition & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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>`_)
- 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>`_)
- 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>`__
Expand Down
2 changes: 1 addition & 1 deletion docs
11 changes: 8 additions & 3 deletions platformio/package/commands/publish.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ def validate_datetime(ctx, param, value): # pylint: disable=unused-argument
help="PIO Account username (can be organization username). "
"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(
"--released-at",
callback=validate_datetime,
Expand All @@ -69,13 +74,13 @@ def validate_datetime(ctx, param, value): # pylint: disable=unused-argument
help="Do not show interactive prompt",
)
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")
owner = owner or AccountClient().get_logged_username()
do_not_pack = not os.path.isdir(package) and isinstance(
FileUnpacker.new_archiver(package), TARArchiver
)
) and PackageType.from_archive(package)
archive_path = None
with tempfile.TemporaryDirectory() as tmp_dir: # pylint: disable=no-member
# publish .tar.gz instantly without repacking
Expand All @@ -86,7 +91,7 @@ def package_publish_cmd( # pylint: disable=too-many-arguments, too-many-locals
p = PackagePacker(package)
archive_path = p.pack()

type_ = PackageType.from_archive(archive_path)
type_ = type_ or PackageType.from_archive(archive_path)
manifest = ManifestSchema().load_manifest(
ManifestParserFactory.new_from_archive(archive_path).as_dict()
)
Expand Down
4 changes: 1 addition & 3 deletions tests/commands/pkg/test_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,9 +275,7 @@ def test_remove_project_unused_libdeps(

# add new deps
lib_deps = config.get("env:baremetal", "lib_deps")
config.set(
"env:baremetal", "lib_deps", lib_deps + ["bblanchon/ArduinoJson@^5"]
)
config.set("env:baremetal", "lib_deps", lib_deps + ["bblanchon/ArduinoJson@^5"])
config.save()
result = clirunner.invoke(
package_install_cmd,
Expand Down

0 comments on commit 1269ce0

Please sign in to comment.