Skip to content

Commit e8717af

Browse files
author
Thomas Desveaux
committed
base_commands: fix upload_fileset not updated on drop of Bittornado dep
1 parent 86404ba commit e8717af

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

nimp/artifacts.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -319,11 +319,15 @@ def create_artifact(
319319
shutil.move(artifact_path_tmp, artifact_path)
320320

321321

322+
def ensure_can_create_torrent() -> None:
323+
if torf is None:
324+
raise ImportError("nimp require the 'torrent' extra dependency to handle torrent creation")
325+
326+
322327
def create_torrent(artifact_path: StrPathLike, announce: str | None, dry_run: bool) -> None:
323328
'''Create a torrent for an existing artifact'''
324329

325-
if torf is None:
326-
raise ImportError("nimp require the 'torrent' extra dependency to handle torrent creation")
330+
ensure_can_create_torrent()
327331

328332
artifact_path = Path(artifact_path)
329333

nimp/base_commands/upload_fileset.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@
2727
import shutil
2828
import zipfile
2929

30-
import nimp.command
3130
import nimp.artifacts
31+
import nimp.command
3232

3333

3434
def _try_remove(file_path, dry_run):
@@ -59,9 +59,8 @@ def is_available(self, env):
5959
return True, ''
6060

6161
def run(self, env):
62-
if env.torrent and nimp.system.try_import('BitTornado') is None:
63-
logging.error('Failed to import BitTornado module (required for torrent option)')
64-
return False
62+
if env.torrent:
63+
nimp.artifacts.ensure_can_create_torrent()
6564

6665
if env.torrent and not hasattr(env, 'torrent_tracker_announce'):
6766
env.torrent_tracker_announce = None

0 commit comments

Comments
 (0)