-
Notifications
You must be signed in to change notification settings - Fork 90
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
Make it work both with Python2 and Python3 #488
Conversation
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed (or fixed any issues), please reply here (e.g. What to do if you already signed the CLAIndividual signers
Corporate signers
ℹ️ Googlers: Go here for more info. |
CLAs look good, thanks! ℹ️ Googlers: Go here for more info. |
print >> f, '</table>' | ||
print >> f, _HTML_FOOTER | ||
f.write('<td>'.join(cols) + '\n') | ||
f.write('<tr><td colspan=4> ') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why no '\n' added in these lines?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
meant to make that a review comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, you are right! adding these '\n' ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for this. Saw a few newlines I wasn't sure about.
nototools/noto_cmap_reqs.py
Outdated
@@ -3285,10 +3285,10 @@ def _dump_primaries(): | |||
for block in unicode_data.block_names(): | |||
block_range = unicode_data.block_range(block) | |||
primary_script = _primary_script_for_block(block) | |||
print '%13s %6s %s' % ( | |||
print('%13s %6s %s\n' % ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems the '\n' is not wanted here? Print already issues a newline, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right! Sorry!
nototools/sync_repos.py
Outdated
@@ -84,17 +84,17 @@ def noto_checkout( | |||
failed_tags.append('%s: %s' % (r, t)) | |||
|
|||
if failed_tags: | |||
print >> sys.stderr, 'failed to find:\n %s' % '\n '.join(failed_tags) | |||
sys.stderr.write('failed to find:\n %s' % '\n \n'.join(failed_tags)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The added newline is in the wrong place.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes!
nototools/unicode_data.py
Outdated
@@ -784,7 +784,7 @@ def _read_emoji_data(lines): | |||
continue | |||
|
|||
# discourage lots of redundant copies of seq_type |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
delete comment, no longer applies?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, no longer applies when the intern() is gone!
print >> f, '</table>' | ||
print >> f, _HTML_FOOTER | ||
f.write('<td>'.join(cols) + '\n') | ||
f.write('<tr><td colspan=4> ') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
meant to make that a review comment
We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google. ℹ️ Googlers: Go here for more info. |
So this will close #472 when merged then. |
Do I need to do something about the “Need a CLA for one or more commit authors”? The commits have mfabian@redhat.com as the author e-mail, should I change that to my Google mail maiku.fabian@gmail.com because I used that to sign the CLA? I tried to add mfabian@redhat.com as an additional address to my google account, but that didn’t work because it is used in my work account and apparently one cannot add the same address to another google account. |
Hmmm, I'm not sure about workarounds for this. If you can change the
commit address that would likely work.
…On Thu, Jul 18, 2019 at 12:29 AM Mike FABIAN ***@***.***> wrote:
Do I need to do something about the “Need a CLA for one or more commit
authors”?
The commits have ***@***.*** as the author e-mail, should I change
that to my Google mail ***@***.*** because I used that to sign
the CLA? I tried to add ***@***.*** as an additional address to my
google account, but that didn’t work because it is used in my work account
and apparently one cannot add the same address to another google account.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#488>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ACL2SDBALPYTJH6S2AQPRK3QAALWXANCNFSM4ID625HQ>
.
|
…dded '\n' And remove a comment about intern() which no longer applies.
CLAs look good, thanks! ℹ️ Googlers: Go here for more info. |
I have changed the commit address. |
I can't get
and then:
I eventually managed to get al requirements in order by manual installs through pip3 and brew. I was able to run:
So while it's working now (a Noto Emoji build is happily purring in the background), I'm not sure if I'm doing something wrong, the requirements.txt need to be modified or something else is wrong. Any advice? |
If nobody else is running into problems, bite the bullet and go full python 3? @dougfelt |
googlefonts/noto-emoji#267 is waiting for this PR. Can we merge this? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for this! LGTM
@@ -99,7 +99,7 @@ def _collect_script_to_punct(files): | |||
script = cldr_data.get_likely_script(filename) | |||
if script == 'Zzzz': | |||
if filename != 'root': | |||
print >> sys.stderr, 'no script for %s' % filename | |||
sys.stderr.write('no script for %s\n' % filename) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to use print
with stderr you can do:
sys.stderr.write('no script for %s\n' % filename) | |
print('no script for %s' % filename, file=sys.stderr) |
but sys.stderr.write
works too
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sys.stderr.write(foo) works in both python2 and python3, print(foo, file=sys.stderr) only works in python3.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to from __future__ import print_function
.
If we haven't done that yet, we should make sure to add this as well as the other two canonical future imports (absolute_import
, division
) to all modules.
@@ -468,7 +468,7 @@ def _process_data(data): | |||
arg_type = m.group(4) | |||
comment = m.group(5) | |||
|
|||
while line_indent <= indent[0]: | |||
while len(line_indent) <= indent[0]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good catch. Surprising how py2 would silently let you to compare a string with an int.. I wonder if this was working at all before
@@ -783,8 +783,7 @@ def _read_emoji_data(lines): | |||
if m.group(2): | |||
continue | |||
|
|||
# discourage lots of redundant copies of seq_type | |||
seq_type = intern(m.group(3).strip().encode('ascii')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FWIW the old intern
builtin was moved to sys.intern
: https://docs.python.org/3/library/sys.html?highlight=sys.intern#sys.intern
With this change (and some changes I did to the python code in https://github.com/googlei18n/noto-emoji.git I was able to build the "NotoColorEmoji.ttf" font using Python3.