8000 simplify utils.get_package_metadata and make two parallel build possible by stonebig · Pull Request #1528 · winpython/winpython · GitHub
[go: up one dir, main page]

Skip to content

simplify utils.get_package_metadata and make two parallel build possible #1528

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion make.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ def create_installer_7zip(self, installer_type: str = ".exe"):
("INSTALLER_OPTION", installer_type),
]

build_installer_7zip(PORTABLE_DIRECTORY / template_name, PORTABLE_DIRECTORY / output_name, replacements)
build_installer_7zip(PORTABLE_DIRECTORY / template_name, self.target_directory / output_name, replacements)

def _print_action(self, text: str):
"""Prints an action message with progress indicator."""
Expand Down
2 changes: 1 addition & 1 deletion winpython/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@
OTHER DEALINGS IN THE SOFTWARE.
"""

__version__ = '15.0.20250330'
__version__ = '15.1.20250405'
__license__ = __doc__
__project_url__ = 'http://winpython.github.io/'
30 changes: 2 additions & 28 deletions winpython/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -659,19 +659,12 @@ def normalize(this):
"""apply https://peps.python.org/pep-0503/#normalized-names"""
return re.sub(r"[-_.]+", "-", this).lower()

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

if my_metadata.get("description") == "" and suggested_summary:
# nothing in package.ini, we look in our installed packages
try:
my_metadata["description"] = (
suggested_summary + "\n"
).splitlines()[0]
except:
pass

if update == True and db_desc == "" and my_metadata["description"] != "":
# we add new findings in our packgages.ini list, if it's required
try:
db[normalize(name)] = {}
db[normalize(name)]["description"] = my_metadata["description"]
with open(str(Path(DATA_PATH) / database), "w", encoding='UTF-8') as configfile:
db.write(configfile)
except:
pass
return my_metadata


Expand Down
0