2013-11-26 13:41:18 +01:00
|
|
|
module Docs
|
2024-07-24 23:57:30 +02:00
|
|
|
class Python < UrlScraper
|
2018-06-14 15:01:46 -04:00
|
|
|
self.type = 'python'
|
2021-12-07 19:29:18 +01:00
|
|
|
self.root_path = 'index.html'
|
2017-03-25 12:57:11 -04:00
|
|
|
self.links = {
|
|
|
|
|
home: 'https://www.python.org/',
|
|
|
|
|
code: 'https://github.com/python/cpython'
|
|
|
|
|
}
|
2013-11-26 13:41:18 +01:00
|
|
|
|
2023-10-16 20:49:38 +08:00
|
|
|
# bypass the clean_text filter as it removes empty span with ids
|
|
|
|
|
options[:clean_text] = false
|
|
|
|
|
|
|
|
|
|
# bypass sphinx modifying empty ids
|
|
|
|
|
options[:sphinx_keep_empty_ids] = true
|
|
|
|
|
|
2022-10-02 12:34:22 +02:00
|
|
|
options[:skip_patterns] = [/whatsnew/]
|
2013-11-26 13:41:18 +01:00
|
|
|
options[:skip] = %w(
|
|
|
|
|
library/2to3.html
|
|
|
|
|
library/formatter.html
|
|
|
|
|
library/intro.html
|
|
|
|
|
library/undoc.html
|
|
|
|
|
library/unittest.mock-examples.html
|
|
|
|
|
library/sunau.html)
|
|
|
|
|
|
|
|
|
|
options[:attribution] = <<-HTML
|
2025-03-06 09:51:31 +01:00
|
|
|
© 2001–2025 Python Software Foundation<br>
|
2013-11-26 13:41:18 +01:00
|
|
|
Licensed under the PSF License.
|
|
|
|
|
HTML
|
2016-01-17 13:30:46 -05:00
|
|
|
|
2025-08-14 18:32:07 +02:00
|
|
|
version '3.14' do
|
2026-03-04 20:36:18 +01:00
|
|
|
self.release = '3.14.3'
|
2025-08-14 18:32:07 +02:00
|
|
|
self.base_url = "https://docs.python.org/#{self.version}/"
|
|
|
|
|
|
|
|
|
|
html_filters.push 'python/entries_v3', 'sphinx/clean_html', 'python/clean_html'
|
|
|
|
|
end
|
|
|
|
|
|
2024-08-18 13:23:16 +02:00
|
|
|
version '3.13' do
|
2025-10-08 08:59:07 +02:00
|
|
|
self.release = '3.13.8'
|
2024-08-18 13:23:16 +02:00
|
|
|
self.base_url = "https://docs.python.org/#{self.version}/"
|
|
|
|
|
|
|
|
|
|
html_filters.push 'python/entries_v3', 'sphinx/clean_html', 'python/clean_html'
|
|
|
|
|
end
|
|
|
|
|
|
2023-10-09 21:11:34 +02:00
|
|
|
version '3.12' do
|
2025-03-06 09:51:31 +01:00
|
|
|
self.release = '3.12.9'
|
2023-10-09 21:11:34 +02:00
|
|
|
self.base_url = "https://docs.python.org/#{self.version}/"
|
|
|
|
|
|
|
|
|
|
html_filters.push 'python/entries_v3', 'sphinx/clean_html', 'python/clean_html'
|
|
|
|
|
end
|
|
|
|
|
|
2022-10-05 21:03:41 +02:00
|
|
|
version '3.11' do
|
2025-03-06 09:51:31 +01:00
|
|
|
self.release = '3.11.11'
|
2022-10-05 21:03:41 +02:00
|
|
|
self.base_url = "https://docs.python.org/#{self.version}/"
|
|
|
|
|
|
|
|
|
|
html_filters.push 'python/entries_v3', 'sphinx/clean_html', 'python/clean_html'
|
|
|
|
|
end
|
|
|
|
|
|
2021-10-25 17:02:28 +02:00
|
|
|
version '3.10' do
|
2023-10-09 21:11:34 +02:00
|
|
|
self.release = '3.10.13'
|
2021-10-25 17:02:28 +02:00
|
|
|
self.base_url = "https://docs.python.org/#{self.version}/"
|
|
|
|
|
|
|
|
|
|
html_filters.push 'python/entries_v3', 'sphinx/clean_html', 'python/clean_html'
|
|
|
|
|
end
|
|
|
|
|
|
2021-04-30 00:02:19 +02:00
|
|
|
version '3.9' do
|
2022-10-26 12:49:29 +02:00
|
|
|
self.release = '3.9.14'
|
2020-11-13 00:23:28 +01:00
|
|
|
self.base_url = 'https://docs.python.org/3.9/'
|
|
|
|
|
|
|
|
|
|
html_filters.push 'python/entries_v3', 'sphinx/clean_html', 'python/clean_html'
|
|
|
|
|
end
|
|
|
|
|
|
2021-04-30 00:02:19 +02:00
|
|
|
version '3.8' do
|
2022-10-26 12:49:29 +02:00
|
|
|
self.release = '3.8.14'
|
2019-11-24 17:23:50 +01:00
|
|
|
self.base_url = 'https://docs.python.org/3.8/'
|
|
|
|
|
|
|
|
|
|
html_filters.push 'python/entries_v3', 'sphinx/clean_html', 'python/clean_html'
|
|
|
|
|
end
|
|
|
|
|
|
2021-04-30 00:02:19 +02:00
|
|
|
version '3.7' do
|
2022-10-26 12:49:29 +02:00
|
|
|
self.release = '3.7.14'
|
2018-07-08 16:34:29 -04:00
|
|
|
self.base_url = 'https://docs.python.org/3.7/'
|
|
|
|
|
|
|
|
|
|
html_filters.push 'python/entries_v3', 'sphinx/clean_html', 'python/clean_html'
|
|
|
|
|
end
|
|
|
|
|
|
2021-04-30 00:02:19 +02:00
|
|
|
version '3.6' do
|
2020-11-13 00:21:59 +01:00
|
|
|
self.release = '3.6.12'
|
2017-01-02 15:48:29 -05:00
|
|
|
self.base_url = 'https://docs.python.org/3.6/'
|
|
|
|
|
|
|
|
|
|
html_filters.push 'python/entries_v3', 'sphinx/clean_html', 'python/clean_html'
|
|
|
|
|
end
|
|
|
|
|
|
2021-04-30 00:02:19 +02:00
|
|
|
version '3.5' do
|
2019-11-24 17:23:50 +01:00
|
|
|
self.release = '3.5.9'
|
2016-01-17 13:30:46 -05:00
|
|
|
self.base_url = 'https://docs.python.org/3.5/'
|
|
|
|
|
|
2016-07-03 18:45:29 -04:00
|
|
|
html_filters.push 'python/entries_v3', 'sphinx/clean_html', 'python/clean_html'
|
2016-01-17 13:30:46 -05:00
|
|
|
end
|
|
|
|
|
|
2021-04-30 00:02:19 +02:00
|
|
|
version '2.7' do
|
2020-01-09 12:15:25 -05:00
|
|
|
self.release = '2.7.17'
|
2016-01-17 13:30:46 -05:00
|
|
|
self.base_url = 'https://docs.python.org/2.7/'
|
|
|
|
|
|
2016-07-03 18:45:29 -04:00
|
|
|
html_filters.push 'python/entries_v2', 'sphinx/clean_html', 'python/clean_html'
|
2016-01-17 13:30:46 -05:00
|
|
|
end
|
2019-03-09 20:22:48 +01:00
|
|
|
|
2019-03-10 03:02:24 +01:00
|
|
|
def get_latest_version(opts)
|
|
|
|
|
doc = fetch_doc('https://docs.python.org/', opts)
|
2020-11-06 22:51:23 +01:00
|
|
|
doc.at_css('title').content.split(' ')[0]
|
2019-03-09 20:22:48 +01:00
|
|
|
end
|
2013-11-26 13:41:18 +01:00
|
|
|
end
|
|
|
|
|
end
|