tappack 0.3.0__tar.gz → 0.3.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: tappack
3
- Version: 0.3.0
3
+ Version: 0.3.2
4
4
  Summary: A packager for Tasmota Berry Application (TAPP) apps
5
5
  Home-page: https://link.frontmatter.ai/tappack
6
6
  Author: Frontmatter
@@ -3,4 +3,4 @@ from datetime import datetime
3
3
  ENCODING = 'utf-8'
4
4
  NAME_MANIFEST = 'manifest.yaml'
5
5
  RUNTIME = datetime.now()
6
- CODE_MASK_DEFAULT = 'tasmota.urlfetch("{url}")'
6
+ CODE_MASK_DEFAULT = '{{"download":tasmota.urlfetch("{url}"), "restart":tasmota.cmd("restart 1")}}'
@@ -1,12 +1,11 @@
1
1
  import io
2
2
  import logging
3
+ import requests
4
+ import yaml
3
5
  import zipfile
4
6
  from functools import cached_property
5
7
  from pathlib import Path
6
8
 
7
- import requests
8
- import yaml
9
-
10
9
  from tappack.constants import ENCODING, NAME_MANIFEST
11
10
  from tappack.patch import Version
12
11
 
@@ -212,6 +211,7 @@ class URL(Source):
212
211
  def get_content(self):
213
212
  print(f'Downloading dependency "{self.name}" from "{self.url}"...')
214
213
  response = requests.get(self.url)
214
+ response.raise_for_status()
215
215
  return response.content
216
216
 
217
217
  def iter_files(self, prefix=None):
@@ -232,15 +232,16 @@ class URL(Source):
232
232
 
233
233
  class GitHubReleaseAsset(URL):
234
234
 
235
- def __init__(self, name, org, repo, filename, version=None, channel_id=None):
235
+ def __init__(self, name, org, repo, filename, version=None, prefix='v', channel_id=None):
236
236
  self.name = name
237
237
  self.org = org
238
238
  self.repo = repo
239
239
  self.filename = filename
240
240
  self.version = version
241
241
  self.channel_id = channel_id
242
+ self.prefix = prefix
242
243
 
243
- def get_latest(self):
244
+ def get_tag_latest(self):
244
245
  url = f"https://api.github.com/repos/{self.org}/{self.repo}/releases/latest"
245
246
 
246
247
  headers = {
@@ -258,10 +259,16 @@ class GitHubReleaseAsset(URL):
258
259
 
259
260
  return tag
260
261
 
262
+ @cached_property
263
+ def tag(self):
264
+ if not self.version:
265
+ return None
266
+ return f'{self.prefix or ""}{self.version}'
267
+
261
268
  @cached_property
262
269
  def url(self):
263
- version = self.version or self.get_latest()
264
- url = f'https://github.com/{self.org}/{self.repo}/releases/download/{version}/{self.filename}'
270
+ tag = self.tag or self.get_tag_latest()
271
+ url = f'https://github.com/{self.org}/{self.repo}/releases/download/{tag}/{self.filename}'
265
272
 
266
273
  return url
267
274
 
@@ -0,0 +1 @@
1
+ 0.3.2
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: tappack
3
- Version: 0.3.0
3
+ Version: 0.3.2
4
4
  Summary: A packager for Tasmota Berry Application (TAPP) apps
5
5
  Home-page: https://link.frontmatter.ai/tappack
6
6
  Author: Frontmatter
@@ -1 +0,0 @@
1
- 0.3.0
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes