Skip to content

Commit

Permalink
Fixed an issue when "pio package publish" command removes original ar…
Browse files Browse the repository at this point in the history
…chive after submitting to the registry // Resolve #3716
  • Loading branch information
ivankravets committed Oct 28, 2020
1 parent cacddb9 commit adf9ba2
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
1 change: 1 addition & 0 deletions HISTORY.rst
Expand Up @@ -17,6 +17,7 @@ PlatformIO Core 5
- Fixed a "KeyError: 'versions'" when dependency does not exist in the registry (`issue #3666 <https://github.com/platformio/platformio-core/issues/3666>`_)
- Fixed an issue with GCC linker when "native" dev-platform is used in pair with library dependencies (`issue #3669 <https://github.com/platformio/platformio-core/issues/3669>`_)
- Fixed an "AssertionError: ensure_dir_exists" when checking library updates from simultaneous subprocesses (`issue #3677 <https://github.com/platformio/platformio-core/issues/3677>`_)
- Fixed an issue when "pio package publish" command removes original archive after submitting to the registry `issue #3716 <https://github.com/platformio/platformio-core/issues/3716>`_)

5.0.1 (2020-09-10)
~~~~~~~~~~~~~~~~~~
Expand Down
20 changes: 13 additions & 7 deletions platformio/commands/package.py
Expand Up @@ -13,11 +13,14 @@
# limitations under the License.

import os
import tempfile
from datetime import datetime

import click

from platformio import fs
from platformio.clients.registry import RegistryClient
from platformio.compat import ensure_python3
from platformio.package.meta import PackageSpec, PackageType
from platformio.package.pack import PackagePacker

Expand Down Expand Up @@ -77,13 +80,16 @@ def package_pack(package, output):
help="Notify by email when package is processed",
)
def package_publish(package, owner, released_at, private, notify):
p = PackagePacker(package)
archive_path = p.pack()
response = RegistryClient().publish_package(
archive_path, owner, released_at, private, notify
)
os.remove(archive_path)
click.secho(response.get("message"), fg="green")
assert ensure_python3()
with tempfile.TemporaryDirectory() as tmp_dir: # pylint: disable=no-member
with fs.cd(tmp_dir):
p = PackagePacker(package)
archive_path = p.pack()
response = RegistryClient().publish_package(
archive_path, owner, released_at, private, notify
)
os.remove(archive_path)
click.secho(response.get("message"), fg="green")


@cli.command("unpublish", short_help="Remove a pushed package from the registry")
Expand Down

0 comments on commit adf9ba2

Please sign in to comment.