8000 simplify utils.get_package_metadata and make two parallel build possible · winpython/winpython@1787163 · GitHub
[go: up one dir, main page]

Skip to content

Commit 1787163

Browse files
committed
simplify utils.get_package_metadata and make two parallel build possible
1 parent 3a9a1e7 commit 1787163

File tree

3 files changed

+4
-30
lines changed

3 files changed

+4
-30
lines changed

make.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ def create_installer_7zip(self, installer_type: str = ".exe"):
267267
("INSTALLER_OPTION", installer_type),
268268
]
269269

270-
build_installer_7zip(PORTABLE_DIRECTORY / template_name, PORTABLE_DIRECTORY / output_name, replacements)
270+
build_installer_7zip(PORTABLE_DIRECTORY / template_name, self.target_directory / output_name, replacements)
271271

272272
def _print_action(self, text: str):
273273
"""Prints an action message with progress indicator."""

winpython/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,6 @@
2828
OTHER DEALINGS IN THE SOFTWARE.
2929
"""
3030

31-
__version__ = '15.0.20250330'
31+
__version__ = '15.1.20250405'
3232
__license__ = __doc__
3333
__project_url__ = 'http://winpython.github.io/'

winpython/utils.py

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -659,19 +659,12 @@ def normalize(this):
659659
"""apply https://peps.python.org/pep-0503/#normalized-names"""
660660
return re.sub(r"[-_.]+", "-", this).lower()
661661

662-
def get_package_metadata(database, name, update=False, suggested_summary=None):
662+
def get_package_metadata(database, name):
663663
"""Extract infos (description, url) from the local database"""
664-
# for package.ini safety belt
665-
# Note: we could use the PyPI database but this has been written on
666-
# machine which is not connected to the internet
667-
# we store only normalized names now (PEP 503)
668664
DATA_PATH = str(Path(sys.modules['winpython'].__file__).parent /'data')
669665
db = cp.ConfigParser()
670666
filepath = Path(database) if Path(database).is_absolute() else Path(DATA_PATH) / database
671-
try:
672-
db.read_file(open(str(filepath), encoding = 'utf-8'))
673-
except:
674-
db.read_file(open(str(filepath)))
667+
db.read_file(open(str(filepath), encoding = guess_encoding(filepath)[0]))
675668
my_metadata = dict(
676669
description="",
677670
url="https://pypi.org/project/" + name,
@@ -684,26 +677,7 @@ def get_package_metadata(database, name, update=False, suggested_summary=None):
684677
break
685678
except (cp.NoSectionError, cp.NoOptionError):
686679
pass
687-
db_desc = my_metadata.get("description")
688680

689-
if my_metadata.get("description") == "" and suggested_summary:
690-
# nothing in package.ini, we look in our installed packages
691-
try:
692-
my_metadata["description"] = (
693-
suggested_summary + "\n"
694-
).splitlines()[0]
695-
except:
696-
pass
697-
698-
if update == True and db_desc == "" and my_metadata["description"] != "":
699-
# we add new findings in our packgages.ini list, if it's required
700-
try:
701-
db[normalize(name)] = {}
702-
db[normalize(name)]["description"] = my_metadata["description"]
703-
with open(str(Path(DATA_PATH) / database), "w", encoding='UTF-8') as configfile:
704-
db.write(configfile)
705-
except:
706-
pass
707681
return my_metadata
708682

709683

0 commit comments

Comments
 (0)
0