Skip to content
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

🎉 Update grow to v1.0.0 #5292

Merged
merged 32 commits into from
Feb 9, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
98b7489
:construction: Update imports
lluerich Feb 2, 2021
9b80e67
:construction: Python3 specific changes
lluerich Feb 2, 2021
15d2e27
:package: Update extension due to grow update
lluerich Feb 2, 2021
277c77a
Merge branch 'future' into grow-1-update
lluerich Feb 2, 2021
40cf73d
:mute: Remove additional logs
lluerich Feb 2, 2021
12e3caa
:recycle: Join conditions
lluerich Feb 2, 2021
a163240
:recycle: Remove unneeded import
lluerich Feb 2, 2021
5131d0b
🚧 Tentatively enable CI build
matthiasrohmer Feb 2, 2021
c2c2d03
🔧 Enable build stage on Travis CI
matthiasrohmer Feb 2, 2021
fd4f1a0
Merge branch 'grow-1-update' of github.com:ampproject/amp.dev into gr…
lluerich Feb 2, 2021
e7b2f63
📦 Add python3 to apt packages for Travis
matthiasrohmer Feb 2, 2021
7523632
Merge branch 'grow-1-update' of github.com:ampproject/amp.dev into gr…
lluerich Feb 3, 2021
769c242
🐛 Also install python3-pip as apt package
matthiasrohmer Feb 3, 2021
ac3842b
Merge branch 'grow-1-update' of github.com:ampproject/amp.dev into gr…
matthiasrohmer Feb 3, 2021
9ca94a2
🚧 Install python3.5-complete instead of just python3
matthiasrohmer Feb 3, 2021
5615d25
🚧 Try utilizing pyenv to update Python version
matthiasrohmer Feb 3, 2021
b28a169
🚧 Try to set CLOUDSDK_PYTHON for gsutil
matthiasrohmer Feb 3, 2021
4470618
🎉 Use Grow 1 and Python 3 to build pages
matthiasrohmer Feb 3, 2021
de4d047
:construction: Adapt to python3 open()
lluerich Feb 4, 2021
0e70139
Merge branch 'future' into grow-1-update
lluerich Feb 4, 2021
bf65697
:wrench: Enable full build on Travis CI
lluerich Feb 4, 2021
31f2f05
Merge branch 'grow-1-update' of github.com:ampproject/amp.dev into gr…
lluerich Feb 4, 2021
86ef68b
:wrench: Fix indentation
lluerich Feb 4, 2021
4c70db1
🐛 Unquote $order key in document frontmatter
matthiasrohmer Feb 8, 2021
935bc9e
🐛 Correct path for amp-animation reference documentation
matthiasrohmer Feb 8, 2021
4439d58
🐛 Unquote remaining $order keys in documents
matthiasrohmer Feb 8, 2021
de085ad
👽 Gracefully handle encoding when rewriting TOC
matthiasrohmer Feb 8, 2021
5a420a6
📝 Update instructions to use Grow 1 and Python 3
matthiasrohmer Feb 8, 2021
0915e53
🔧 Update minimum required Grow version to 1
matthiasrohmer Feb 8, 2021
c03bce3
:alien: Fix style of code snippets
lluerich Feb 8, 2021
3c896e4
Merge branch 'future' into grow-1-update
lluerich Feb 8, 2021
d0c78ff
⏪ Disable full builds for PRs again
matthiasrohmer Feb 9, 2021
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
Prev Previous commit
Next Next commit
🚧 Python3 specific changes
  • Loading branch information
lluerich committed Feb 2, 2021
commit 9b80e67f695cf3b5e4d4564eaaecb53d054f086c
2 changes: 1 addition & 1 deletion pages/extensions/amp_dependencies/amp_dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def inject(self, content):
self.injected = True

dependencies = ''
for name, details in self._dependencies.iteritems():
for name, details in self._dependencies.items():
version = details[0]

if version is None:
Expand Down
8 changes: 4 additions & 4 deletions pages/extensions/amp_dependencies/auto_dependency_injector.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class AutoDependencyInjector(object):
def add_auto_imports(doc, content, amp_dependencies):
"""
:type doc: document.Document
:type content: basestring
:type content: str
:type amp_dependencies: AmpDependencies
"""

Expand All @@ -34,7 +34,7 @@ def add_auto_imports(doc, content, amp_dependencies):
def should_do_auto_import(doc, content):
"""
:type doc: document.Document
:type content: basestring
:type content: str
:rtype: bool
"""
# Do not run for empty documents
Expand All @@ -52,11 +52,11 @@ def should_do_auto_import(doc, content):
return False

# Quick check if the page is really a AMP page
if not any(marker in content for marker in ['<html amp', '<html ⚡']):
if not any(marker in content for marker in ['<html amp'.encode('utf-8'), '<html ⚡'.encode('utf-8')]):
return False

# And has a head element
if '</head>' not in content:
if '</head>'.encode('utf-8') not in content:
return False

return True
Expand Down
4 changes: 2 additions & 2 deletions pages/extensions/amp_dev/markdown_extras/block_video.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ def _transform(content):
r'v=(\w*)', attributes['src']).group(1) + '\' %}\n'

# Add in other variables
for name, value in attributes.iteritems():
if isinstance(value, basestring):
for name, value in attributes.items():
if isinstance(value, str):
replacement += '{% set ' + name + ' = \'' + value + '\' %}\n'
else:
value = str(value)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ def createTempDoc(self, formats):
def get_validation_errors(self, validator_output):
errors = []
validations = json.loads(validator_output)
for path, result in validations.iteritems():
for path, result in validations.items():
if result['status'] == 'FAIL':
error_message = self.get_error_text_pattern(path)
for error in result['errors']:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def get_components(identifiers):
result = []

if identifiers:
if isinstance(identifiers, basestring):
if isinstance(identifiers, str):
collection = identifiers.split(',')
else:
collection = identifiers
Expand Down
6 changes: 3 additions & 3 deletions pages/extensions/amp_example_preview/util/example_exporter.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import os
import urlparse
import urllib.parse
import errno
from grow.documents import document
from .constants import FORMAT_TYPE_IDS, DEFAULT_FORMAT
Expand Down Expand Up @@ -32,8 +32,8 @@ def __init__(self, doc, example_document, type_id):
self.base_url = doc.pod.get_podspec().yaml.get('base_urls').get('preview')

self.file_path = self.get_file_path(doc, example_document.index, type_id)
self.canonical = urlparse.urljoin(self.base_url, self.file_path)
self.url_without_format = urlparse.urljoin(self.base_url,
self.canonical = urllib.parse.urljoin(self.base_url, self.file_path)
self.url_without_format = urllib.parse.urljoin(self.base_url,
self.get_file_path(doc, example_document.index, DEFAULT_FORMAT))

self.language = doc.locale
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import StringIO
import io
from pygments.formatters import html
from .jinja2_expression_unescape import unescape_in_expressions


class CustomHtmlFormatter(html.HtmlFormatter):

def format_unencoded(self, tokensource, outfile):
buffer = StringIO.StringIO()
buffer = io.StringIO()
super(CustomHtmlFormatter, self).format_unencoded(tokensource, buffer)
content = buffer.getvalue()
content = unescape_in_expressions(content)
Expand All @@ -15,4 +15,4 @@ def format_unencoded(self, tokensource, outfile):

@staticmethod
def connect_hook():
html.HtmlFormatter = CustomHtmlFormatter
html.HtmlFormatter = CustomHtmlFormatter
2 changes: 1 addition & 1 deletion pages/extensions/markdown_in_html/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class MarkdownInHtmlExtension(extensions.BaseExtension):
def __init__(self, pod, config):
super(MarkdownInHtmlExtension, self).__init__(pod, config)

if config.has_key(CLEAR_EXTRA_EXTENSIONS_FLAG) and config.get(CLEAR_EXTRA_EXTENSIONS_FLAG):
if config.__contains__(CLEAR_EXTRA_EXTENSIONS_FLAG) and config.get(CLEAR_EXTRA_EXTENSIONS_FLAG):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm... if config.get(CLEAR_EXTRA_EXTENSIONS_FLAG, None) should actually be enough. Methods pre- and postfixed with __ are not meant to be called directly.

# Clear the markdown extra extensions to prevent auto loading unwanted extensions
extra.extensions = []

Expand Down