Adds a 2to3 python conversion bash script

* includes flag to ignore unicode (fixes #79)
* helps keeps py3 version up to date with py2 version
This commit is contained in:
ryanoasis 2016-05-14 10:06:34 -04:00
parent 06fc6947a3
commit fff3e46331

View file

@ -0,0 +1,27 @@
#!/bin/bash
# project: Nerd Fonts (https://github.com/ryanoasis/nerd-fonts)
# version: 0.8.0
# Executes the 2to3 conversion to generate latest py3 version of font patcher
# Check for 2to3
type 2to3 >/dev/null 2>&1 || {
echo >&2 "2to3 must be installed before running this script."
echo >&2 "Please see details at"
echo >&2 "https://docs.python.org/2/library/2to3.html"
exit 1
}
# -x unicode: ignore changing unicode to str
# purpose: to prevent 2to3 by default from changing 'unicode' to 'str'
# because in FontForge 'str' is not an attribute of the glyph object
# for more information:
# see: https://docs.python.org/2/library/2to3.html#to3-fixers
# see: https://github.com/ryanoasis/nerd-fonts/issues/49
# see: https://github.com/ryanoasis/nerd-fonts/issues/79
2to3 -x unicode -n -w ../font-patcher --add-suffix=-py3
# fix environment (first line in file)
# from `/usr/bin/env python2` when it should
# be `/usr/bin/env python3`
# using 1 as line number and '%' as delimiter:
sed -i '1s%.*%#!/usr/bin/env python3%' ../font-patcher-py3