pyappify 0.0.5__tar.gz → 1.0.0__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.4
2
2
  Name: pyappify
3
- Version: 0.0.5
3
+ Version: 1.0.0
4
4
  Summary: My awesome Python application
5
5
  Classifier: Programming Language :: Python :: 3
6
6
  Classifier: License :: OSI Approved :: MIT License
@@ -74,37 +74,47 @@ def hide_pyappify():
74
74
  pass
75
75
 
76
76
  def upgrade(to_version, executable_sha256, executable_zip_urls, stop_event=None):
77
- if not pyappify_upgradeable or (to_version and to_version.lstrip('v') == pyappify_version.lstrip('v')):
77
+ if not pyappify_upgradeable or (to_version and pyappify_version and to_version.lstrip('v') == pyappify_version.lstrip('v')):
78
+ if logger:
79
+ logger.info(f"pyappify no need to upgrade {pyappify_upgradeable} {to_version} {executable_sha256} {executable_zip_urls}")
78
80
  return
79
-
81
+ if logger:
82
+ logger.info(
83
+ f"pyappify start to upgrade {pyappify_upgradeable} {to_version} {executable_sha256} {executable_zip_urls}")
80
84
  def _do_upgrade():
81
- tmp_dir = os.path.join(os.getcwd(), "tmp")
85
+ tmp_dir = os.path.join(os.getcwd(), "pyappify_tmp")
82
86
  try:
83
87
  os.makedirs(tmp_dir, exist_ok=True)
84
88
  downloaded_zip_path = None
85
89
  for url in executable_zip_urls:
86
90
  try:
91
+ if logger:
92
+ logger.info(
93
+ f"pyappify start to download {url}")
87
94
  local_zip_path = os.path.join(tmp_dir, os.path.basename(url))
88
95
  with urllib.request.urlopen(url) as response, open(local_zip_path, 'wb') as out_file:
89
96
  while True:
90
97
  if stop_event and stop_event.is_set():
91
98
  if logger:
92
- logger.info("Upgrade download cancelled by stop event.")
99
+ logger.info("pyappify Upgrade download cancelled by stop event.")
93
100
  return
94
101
  chunk = response.read(8192)
95
102
  if not chunk:
96
103
  break
97
104
  out_file.write(chunk)
98
105
  downloaded_zip_path = local_zip_path
106
+ if logger:
107
+ logger.info(
108
+ f"pyappify download success {url}")
99
109
  break
100
110
  except Exception as e:
101
111
  if logger:
102
- logger.warning(f"Failed to download from {url}: {e}")
112
+ logger.warning(f"pyappify Failed to download from {url}: {e}")
103
113
  continue
104
114
 
105
115
  if not downloaded_zip_path:
106
116
  if logger:
107
- logger.error("Failed to download upgrade.")
117
+ logger.error("pyappify Failed to download upgrade.")
108
118
  return
109
119
 
110
120
  with zipfile.ZipFile(downloaded_zip_path, 'r') as zip_ref:
@@ -119,7 +129,7 @@ def upgrade(to_version, executable_sha256, executable_zip_urls, stop_event=None)
119
129
 
120
130
  if not found_executable_path:
121
131
  if logger:
122
- logger.error("Executable not found in zip.")
132
+ logger.error("pyappify Executable not found in zip.")
123
133
  return
124
134
 
125
135
  sha256_hash = hashlib.sha256()
@@ -129,14 +139,16 @@ def upgrade(to_version, executable_sha256, executable_zip_urls, stop_event=None)
129
139
 
130
140
  if sha256_hash.hexdigest() != executable_sha256:
131
141
  if logger:
132
- logger.error("SHA256 checksum mismatch.")
142
+ logger.error("pyappify SHA256 checksum mismatch.")
133
143
  return
134
144
 
135
145
  kill_pyappify()
136
146
  shutil.move(found_executable_path, pyappify_executable)
147
+ if logger:
148
+ logger.info(f"pyappify Upgrade success")
137
149
  except Exception as e:
138
150
  if logger:
139
- logger.error(f"Upgrade failed: {e}")
151
+ logger.error(f"pyappify Upgrade failed: {e}")
140
152
  finally:
141
153
  if os.path.exists(tmp_dir):
142
154
  shutil.rmtree(tmp_dir)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyappify
3
- Version: 0.0.5
3
+ Version: 1.0.0
4
4
  Summary: My awesome Python application
5
5
  Classifier: Programming Language :: Python :: 3
6
6
  Classifier: License :: OSI Approved :: MIT License
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "pyappify"
7
- version = "0.0.5"
7
+ version = "1.0.0"
8
8
  description = "My awesome Python application"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.7"
File without changes
File without changes