Skip to content

Commit

Permalink
Small update
Browse files Browse the repository at this point in the history
  • Loading branch information
KazukiPrzyborowski committed Oct 22, 2024
1 parent 07e995a commit 1d3e2ed
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 23 deletions.
6 changes: 3 additions & 3 deletions pywwwget.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
Copyright 2016-2023 Game Maker 2k - https://github.com/GameMaker2k
Copyright 2016-2023 Kazuki Przyborowski - https://github.com/KazukiPrzyborowski
$FileInfo: pywwwget.py - Last Update: 10/5/2023 Ver. 2.0.2 RC 1 - Author: cooldude2k $
$FileInfo: pywwwget.py - Last Update: 10/22/2024 Ver. 2.1.0 RC 1 - Author: cooldude2k $
'''

from __future__ import absolute_import, division, print_function, unicode_literals, generators, with_statement, nested_scopes
Expand Down Expand Up @@ -159,8 +159,8 @@
__program_small_name__ = "wwwget"
__project__ = __program_name__
__project_url__ = "https://github.com/GameMaker2k/PyWWW-Get"
__version_info__ = (2, 0, 2, "RC 1", 1)
__version_date_info__ = (2023, 10, 5, "RC 1", 1)
__version_info__ = (2, 1, 0, "RC 1", 1)
__version_date_info__ = (2024, 10, 22, "RC 1", 1)
__version_date__ = str(__version_date_info__[0])+"."+str(__version_date_info__[
1]).zfill(2)+"."+str(__version_date_info__[2]).zfill(2)
__revision__ = __version_info__[3]
Expand Down
6 changes: 3 additions & 3 deletions pywwwgetmini.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
Copyright 2015-2024 Game Maker 2k - https://github.com/GameMaker2k
Copyright 2015-2024 Kazuki Przyborowski - https://github.com/KazukiPrzyborowski
$FileInfo: pywwwget.py - Last Update: 10/17/2024 Ver. 0.9.6 RC 1 - Author: cooldude2k $
$FileInfo: pywwwget.py - Last Update: 10/22/2024 Ver. 2.1.0 RC 1 - Author: cooldude2k $
'''

from __future__ import absolute_import, division, print_function, unicode_literals, generators, with_statement, nested_scopes
Expand Down Expand Up @@ -119,8 +119,8 @@
__program_small_name__ = "wwwget"
__project__ = __program_name__
__project_url__ = "https://github.com/GameMaker2k/PyWWW-Get"
__version_info__ = (2, 0, 2, "RC 1", 1)
__version_date_info__ = (2023, 10, 5, "RC 1", 1)
__version_info__ = (2, 1, 0, "RC 1", 1)
__version_date_info__ = (2024, 10, 22, "RC 1", 1)
__version_date__ = str(__version_date_info__[0])+"."+str(__version_date_info__[
1]).zfill(2)+"."+str(__version_date_info__[2]).zfill(2)
__revision__ = __version_info__[3]
Expand Down
6 changes: 3 additions & 3 deletions pywwwgetold.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
Copyright 2016-2023 Game Maker 2k - https://github.com/GameMaker2k
Copyright 2016-2023 Kazuki Przyborowski - https://github.com/KazukiPrzyborowski
$FileInfo: pywwwgetold.py - Last Update: 10/5/2023 Ver. 2.0.2 RC 1 - Author: cooldude2k $
$FileInfo: pywwwgetold.py - Last Update: 10/22/2024 Ver. 2.1.0 RC 1 - Author: cooldude2k $
'''

from __future__ import absolute_import, division, print_function, unicode_literals, generators, with_statement, nested_scopes
Expand Down Expand Up @@ -159,8 +159,8 @@
__program_small_name__ = "wwwget"
__project__ = __program_name__
__project_url__ = "https://github.com/GameMaker2k/PyWWW-Get"
__version_info__ = (2, 0, 2, "RC 1", 1)
__version_date_info__ = (2023, 10, 5, "RC 1", 1)
__version_info__ = (2, 1, 0, "RC 1", 1)
__version_date_info__ = (2024, 10, 22, "RC 1", 1)
__version_date__ = str(__version_date_info__[0])+"."+str(__version_date_info__[
1]).zfill(2)+"."+str(__version_date_info__[2]).zfill(2)
__revision__ = __version_info__[3]
Expand Down
47 changes: 33 additions & 14 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
Copyright 2016-2023 Game Maker 2k - https://github.com/GameMaker2k
Copyright 2016-2023 Kazuki Przyborowski - https://github.com/KazukiPrzyborowski
$FileInfo: setup.py - Last Update: 10/5/2023 Ver. 2.0.2 RC 1 - Author: cooldude2k $
$FileInfo: setup.py - Last Update: 10/22/2024 Ver. 2.1.0 RC 1 - Author: cooldude2k $
'''

import re
Expand All @@ -25,19 +25,38 @@
import pkg_resources
from setuptools import setup, find_packages

# Open and read the version info file in a Python 2/3 compatible way
verinfofilename = os.path.realpath("."+os.path.sep+os.path.sep+"pywwwget.py")
verinfofile = open(verinfofilename, "r")
verinfodata = verinfofile.read()
verinfofile.close()
setuppy_verinfo_esc = re.escape("__version_info__ = (")+"(.*)"+re.escape(");")
setuppy_verinfo = re.findall(setuppy_verinfo_esc, verinfodata)[0]
setuppy_verinfo_exp = [vergetspt.strip().replace("\"", "")
for vergetspt in setuppy_verinfo.split(',')]
setuppy_dateinfo_esc = re.escape(
"__version_date_info__ = (")+"(.*)"+re.escape(");")
setuppy_dateinfo = re.findall(setuppy_dateinfo_esc, verinfodata)[0]
setuppy_dateinfo_exp = [vergetspt.strip().replace("\"", "")
for vergetspt in setuppy_dateinfo.split(',')]

# Use `with` to ensure the file is properly closed after reading
# In Python 2, open defaults to text mode; in Python 3, it’s better to specify encoding
open_kwargs = {'encoding': 'utf-8'} if sys.version_info[0] >= 3 else {}
with open(verinfofilename, "r", **open_kwargs) as verinfofile:
verinfodata = verinfofile.read()

# Define the regex pattern for extracting version info
# We ensure the pattern works correctly in both Python 2 and 3 by escaping the strings properly
version_pattern = "__version_info__ = \(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*['\"]([\w\s]+)['\"]\s*,\s*(\d+)\s*\)"
setuppy_verinfo = re.findall(version_pattern, verinfodata)[0]

# If version info is found, process it; handle the case where no match is found
if setuppy_verinfo:
setuppy_verinfo_exp = setuppy_verinfo
else:
print("Version info not found.")
setuppy_verinfo_exp = None # Handle missing version info gracefully

# Define the regex pattern for extracting version date info
date_pattern = "__version_date_info__ = \(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*['\"]([\w\s]+)['\"]\s*,\s*(\d+)\s*\)"
setuppy_dateinfo = re.findall(date_pattern, verinfodata)[0]

# If date info is found, process it; handle the case where no match is found
if setuppy_dateinfo:
setuppy_dateinfo_exp = setuppy_dateinfo
else:
print("Date info not found.")
setuppy_dateinfo_exp = None # Handle missing date info gracefully

pymodule = {}
pymodule['version'] = str(setuppy_verinfo_exp[0])+"." + \
str(setuppy_verinfo_exp[1])+"."+str(setuppy_verinfo_exp[2])
Expand All @@ -62,7 +81,7 @@
pymodule['longdescription'] = 'Python libary/module to download files.'
pymodule['platforms'] = 'OS Independent'
pymodule['zipsafe'] = True
pymodule['pymodules'] = ['pywwwget', 'pywwwgetold']
pymodule['pymodules'] = ['pywwwget', 'pywwwgetold', 'pywwwgetmini']
pymodule['scripts'] = ['pywwwget-dl.py', 'pywwwgetold-dl.py', 'pyhttpserv.py']
pymodule['classifiers'] = [
'Development Status :: 5 - Production/Stable',
Expand Down

0 comments on commit 1d3e2ed

Please sign in to comment.