-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
120 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# -*- encoding: utf-8 -*- | ||
# Copyright (c) Tomasz Krol [email protected] | ||
""" | ||
Module to grab actual editions & versions of MacOS | ||
""" | ||
from copy import copy | ||
import urllib.request | ||
import re | ||
from datetime import datetime, date | ||
from bs4 import BeautifulSoup | ||
from unidecode import unidecode | ||
|
||
product = "Apple Mac" | ||
|
||
def getEditions(template): | ||
result = [] | ||
|
||
template.product = product | ||
template.released = date.min | ||
template.ends = date.max | ||
template.stable = True | ||
template.latest = False | ||
maxver = None | ||
|
||
# Looking for releases, source at https://docs.microsoft.com/en-us/windows/windows-10/release-information | ||
body = urllib.request.urlopen("https://support.apple.com/pl-pl/HT201260").read() | ||
soup = BeautifulSoup(body, "html5lib") | ||
table = soup.find('div',{"id":"tableWraper"}).find_next('table') | ||
rows = table.find_all('tr')[1:] | ||
|
||
for index, row in enumerate(rows, start=0): # Python indexes start at zero | ||
|
||
# copy of Softver object | ||
item = copy(template) # copy of Softver object | ||
|
||
# find elements to parse | ||
cols = row.find_all('td') | ||
|
||
# find product name | ||
# item.edition = cols[0].get_text().strip().replace('\u00a0', ' ') | ||
item.edition = unidecode(cols[0].get_text().strip()) | ||
|
||
# find version | ||
item.version = cols[1].get_text().strip() | ||
|
||
# mark the latest version | ||
if maxver is None: | ||
maxver = item.version | ||
item.latest = True | ||
|
||
result.append(item) | ||
return result | ||
|
||
# if __name__ == "__main__": | ||
# print(getEditions(Softver())) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,14 +10,14 @@ | |
from datetime import datetime, date | ||
import vergrabber | ||
|
||
__version__ = '3.4.3' | ||
__version__ = '3.5.0' | ||
__author__ = 'Tomasz Krol' | ||
__author_email__ = '[email protected]' | ||
|
||
debug = False | ||
debug_module = None | ||
# debug = True | ||
# debug_module = 'windows' | ||
# debug_module = 'macos' | ||
|
||
def dumper(obj): | ||
if isinstance(obj, date) or isinstance(obj, datetime): | ||
|
@@ -53,7 +53,7 @@ def applyLatest(result, branch, vergrabber): | |
if __name__ == "__main__": | ||
|
||
print("Vergrabber, a software version grabber", __version__) | ||
print("(C) 2017-2019 by", __author__, __author_email__, "\n") | ||
print("(C) 2017-2020 by", __author__, __author_email__, "\n") | ||
started = datetime.now() | ||
print("* STARTED @ %s" % started) | ||
print("- loading configuration from config.yaml") | ||
|