Merge pull request #1487 from madig/rechange-lineendings-to-lf
Rechange line-endings of some files from DOS to Unix
This commit is contained in:
commit
b517d95b77
6
.gitattributes
vendored
Normal file
6
.gitattributes
vendored
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
# Set the default behavior, in case people don't have core.autocrlf set.
|
||||||
|
* text=auto
|
||||||
|
|
||||||
|
# Explicitly declare text files you want to always be normalized and converted
|
||||||
|
# to native line endings on checkout.
|
||||||
|
*.py text
|
@ -1,10 +1,10 @@
|
|||||||
from __future__ import print_function, division, absolute_import
|
from __future__ import print_function, division, absolute_import
|
||||||
from fontTools.misc.py23 import *
|
from fontTools.misc.py23 import *
|
||||||
import logging
|
import logging
|
||||||
from fontTools.misc.loggingTools import configLogger
|
from fontTools.misc.loggingTools import configLogger
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
version = __version__ = "3.37.3.dev0"
|
version = __version__ = "3.37.3.dev0"
|
||||||
|
|
||||||
__all__ = ["version", "log", "configLogger"]
|
__all__ = ["version", "log", "configLogger"]
|
||||||
|
118
setup.cfg
118
setup.cfg
@ -1,59 +1,59 @@
|
|||||||
[bumpversion]
|
[bumpversion]
|
||||||
current_version = 3.37.3.dev0
|
current_version = 3.37.3.dev0
|
||||||
commit = True
|
commit = True
|
||||||
tag = False
|
tag = False
|
||||||
tag_name = {new_version}
|
tag_name = {new_version}
|
||||||
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(\.(?P<release>[a-z]+)(?P<dev>\d+))?
|
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(\.(?P<release>[a-z]+)(?P<dev>\d+))?
|
||||||
serialize =
|
serialize =
|
||||||
{major}.{minor}.{patch}.{release}{dev}
|
{major}.{minor}.{patch}.{release}{dev}
|
||||||
{major}.{minor}.{patch}
|
{major}.{minor}.{patch}
|
||||||
|
|
||||||
[bumpversion:part:release]
|
[bumpversion:part:release]
|
||||||
optional_value = final
|
optional_value = final
|
||||||
values =
|
values =
|
||||||
dev
|
dev
|
||||||
final
|
final
|
||||||
|
|
||||||
[bumpversion:part:dev]
|
[bumpversion:part:dev]
|
||||||
|
|
||||||
[bumpversion:file:Lib/fontTools/__init__.py]
|
[bumpversion:file:Lib/fontTools/__init__.py]
|
||||||
search = __version__ = "{current_version}"
|
search = __version__ = "{current_version}"
|
||||||
replace = __version__ = "{new_version}"
|
replace = __version__ = "{new_version}"
|
||||||
|
|
||||||
[bumpversion:file:setup.py]
|
[bumpversion:file:setup.py]
|
||||||
search = version="{current_version}"
|
search = version="{current_version}"
|
||||||
replace = version="{new_version}"
|
replace = version="{new_version}"
|
||||||
|
|
||||||
[wheel]
|
[wheel]
|
||||||
universal = 1
|
universal = 1
|
||||||
|
|
||||||
[sdist]
|
[sdist]
|
||||||
formats = zip
|
formats = zip
|
||||||
|
|
||||||
[metadata]
|
[metadata]
|
||||||
license_file = LICENSE
|
license_file = LICENSE
|
||||||
|
|
||||||
[tool:pytest]
|
[tool:pytest]
|
||||||
minversion = 3.0
|
minversion = 3.0
|
||||||
testpaths =
|
testpaths =
|
||||||
Tests
|
Tests
|
||||||
python_files =
|
python_files =
|
||||||
*_test.py
|
*_test.py
|
||||||
python_classes =
|
python_classes =
|
||||||
*Test
|
*Test
|
||||||
addopts =
|
addopts =
|
||||||
-r a
|
-r a
|
||||||
--doctest-modules
|
--doctest-modules
|
||||||
--doctest-ignore-import-errors
|
--doctest-ignore-import-errors
|
||||||
--pyargs
|
--pyargs
|
||||||
doctest_optionflags =
|
doctest_optionflags =
|
||||||
ALLOW_UNICODE
|
ALLOW_UNICODE
|
||||||
ELLIPSIS
|
ELLIPSIS
|
||||||
filterwarnings =
|
filterwarnings =
|
||||||
ignore:tostring:DeprecationWarning
|
ignore:tostring:DeprecationWarning
|
||||||
ignore:fromstring:DeprecationWarning
|
ignore:fromstring:DeprecationWarning
|
||||||
ignore:readPlist:DeprecationWarning:plistlib_test
|
ignore:readPlist:DeprecationWarning:plistlib_test
|
||||||
ignore:writePlist:DeprecationWarning:plistlib_test
|
ignore:writePlist:DeprecationWarning:plistlib_test
|
||||||
ignore:some_function:DeprecationWarning:fontTools.ufoLib.utils
|
ignore:some_function:DeprecationWarning:fontTools.ufoLib.utils
|
||||||
ignore::DeprecationWarning:fontTools.varLib.designspace
|
ignore::DeprecationWarning:fontTools.varLib.designspace
|
||||||
|
|
||||||
|
768
setup.py
768
setup.py
@ -1,384 +1,384 @@
|
|||||||
#! /usr/bin/env python
|
#! /usr/bin/env python
|
||||||
|
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
import io
|
import io
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
from os.path import isfile, join as pjoin
|
from os.path import isfile, join as pjoin
|
||||||
from glob import glob
|
from glob import glob
|
||||||
from setuptools import setup, find_packages, Command
|
from setuptools import setup, find_packages, Command
|
||||||
from distutils import log
|
from distutils import log
|
||||||
from distutils.util import convert_path
|
from distutils.util import convert_path
|
||||||
import subprocess as sp
|
import subprocess as sp
|
||||||
import contextlib
|
import contextlib
|
||||||
import re
|
import re
|
||||||
|
|
||||||
# Force distutils to use py_compile.compile() function with 'doraise' argument
|
# Force distutils to use py_compile.compile() function with 'doraise' argument
|
||||||
# set to True, in order to raise an exception on compilation errors
|
# set to True, in order to raise an exception on compilation errors
|
||||||
import py_compile
|
import py_compile
|
||||||
orig_py_compile = py_compile.compile
|
orig_py_compile = py_compile.compile
|
||||||
|
|
||||||
def doraise_py_compile(file, cfile=None, dfile=None, doraise=False):
|
def doraise_py_compile(file, cfile=None, dfile=None, doraise=False):
|
||||||
orig_py_compile(file, cfile=cfile, dfile=dfile, doraise=True)
|
orig_py_compile(file, cfile=cfile, dfile=dfile, doraise=True)
|
||||||
|
|
||||||
py_compile.compile = doraise_py_compile
|
py_compile.compile = doraise_py_compile
|
||||||
|
|
||||||
needs_wheel = {'bdist_wheel'}.intersection(sys.argv)
|
needs_wheel = {'bdist_wheel'}.intersection(sys.argv)
|
||||||
wheel = ['wheel'] if needs_wheel else []
|
wheel = ['wheel'] if needs_wheel else []
|
||||||
needs_bumpversion = {'release'}.intersection(sys.argv)
|
needs_bumpversion = {'release'}.intersection(sys.argv)
|
||||||
bumpversion = ['bump2version'] if needs_bumpversion else []
|
bumpversion = ['bump2version'] if needs_bumpversion else []
|
||||||
|
|
||||||
extras_require = {
|
extras_require = {
|
||||||
# for fontTools.ufoLib: to read/write UFO fonts
|
# for fontTools.ufoLib: to read/write UFO fonts
|
||||||
"ufo": [
|
"ufo": [
|
||||||
"fs >= 2.2.0, < 3",
|
"fs >= 2.2.0, < 3",
|
||||||
"enum34 >= 1.1.6; python_version < '3.4'",
|
"enum34 >= 1.1.6; python_version < '3.4'",
|
||||||
],
|
],
|
||||||
# for fontTools.misc.etree and fontTools.misc.plistlib: use lxml to
|
# for fontTools.misc.etree and fontTools.misc.plistlib: use lxml to
|
||||||
# read/write XML files (faster/safer than built-in ElementTree)
|
# read/write XML files (faster/safer than built-in ElementTree)
|
||||||
"lxml": [
|
"lxml": [
|
||||||
"lxml >= 4.0, < 5",
|
"lxml >= 4.0, < 5",
|
||||||
"singledispatch >= 3.4.0.3; python_version < '3.4'",
|
"singledispatch >= 3.4.0.3; python_version < '3.4'",
|
||||||
# typing >= 3.6.4 is required when using ABC collections with the
|
# typing >= 3.6.4 is required when using ABC collections with the
|
||||||
# singledispatch backport, see:
|
# singledispatch backport, see:
|
||||||
# https://github.com/fonttools/fonttools/issues/1423
|
# https://github.com/fonttools/fonttools/issues/1423
|
||||||
# https://github.com/python/typing/issues/484
|
# https://github.com/python/typing/issues/484
|
||||||
"typing >= 3.6.4; python_version < '3.4'",
|
"typing >= 3.6.4; python_version < '3.4'",
|
||||||
],
|
],
|
||||||
# for fontTools.sfnt and fontTools.woff2: to compress/uncompress
|
# for fontTools.sfnt and fontTools.woff2: to compress/uncompress
|
||||||
# WOFF 1.0 and WOFF 2.0 webfonts.
|
# WOFF 1.0 and WOFF 2.0 webfonts.
|
||||||
"woff": [
|
"woff": [
|
||||||
"brotli >= 1.0.1; platform_python_implementation != 'PyPy'",
|
"brotli >= 1.0.1; platform_python_implementation != 'PyPy'",
|
||||||
"brotlipy >= 0.7.0; platform_python_implementation == 'PyPy'",
|
"brotlipy >= 0.7.0; platform_python_implementation == 'PyPy'",
|
||||||
"zopfli >= 0.1.4",
|
"zopfli >= 0.1.4",
|
||||||
],
|
],
|
||||||
# for fontTools.unicode and fontTools.unicodedata: to use the latest version
|
# for fontTools.unicode and fontTools.unicodedata: to use the latest version
|
||||||
# of the Unicode Character Database instead of the built-in unicodedata
|
# of the Unicode Character Database instead of the built-in unicodedata
|
||||||
# which varies between python versions and may be outdated.
|
# which varies between python versions and may be outdated.
|
||||||
"unicode": [
|
"unicode": [
|
||||||
# the unicodedata2 extension module doesn't work on PyPy.
|
# the unicodedata2 extension module doesn't work on PyPy.
|
||||||
# Python 3.7 already has Unicode 11, so the backport is not needed.
|
# Python 3.7 already has Unicode 11, so the backport is not needed.
|
||||||
(
|
(
|
||||||
"unicodedata2 >= 11.0.0; "
|
"unicodedata2 >= 11.0.0; "
|
||||||
"python_version < '3.7' and platform_python_implementation != 'PyPy'"
|
"python_version < '3.7' and platform_python_implementation != 'PyPy'"
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
# for graphite type tables in ttLib/tables (Silf, Glat, Gloc)
|
# for graphite type tables in ttLib/tables (Silf, Glat, Gloc)
|
||||||
"graphite": [
|
"graphite": [
|
||||||
"lz4 >= 1.7.4.2"
|
"lz4 >= 1.7.4.2"
|
||||||
],
|
],
|
||||||
# for fontTools.interpolatable: to solve the "minimum weight perfect
|
# for fontTools.interpolatable: to solve the "minimum weight perfect
|
||||||
# matching problem in bipartite graphs" (aka Assignment problem)
|
# matching problem in bipartite graphs" (aka Assignment problem)
|
||||||
"interpolatable": [
|
"interpolatable": [
|
||||||
# use pure-python alternative on pypy
|
# use pure-python alternative on pypy
|
||||||
"scipy; platform_python_implementation != 'PyPy'",
|
"scipy; platform_python_implementation != 'PyPy'",
|
||||||
"munkres; platform_python_implementation == 'PyPy'",
|
"munkres; platform_python_implementation == 'PyPy'",
|
||||||
],
|
],
|
||||||
# for fontTools.varLib.plot, to visualize DesignSpaceDocument and resulting
|
# for fontTools.varLib.plot, to visualize DesignSpaceDocument and resulting
|
||||||
# VariationModel
|
# VariationModel
|
||||||
"plot": [
|
"plot": [
|
||||||
# TODO: figure out the minimum version of matplotlib that we need
|
# TODO: figure out the minimum version of matplotlib that we need
|
||||||
"matplotlib",
|
"matplotlib",
|
||||||
],
|
],
|
||||||
# for fontTools.misc.symfont, module for symbolic font statistics analysis
|
# for fontTools.misc.symfont, module for symbolic font statistics analysis
|
||||||
"symfont": [
|
"symfont": [
|
||||||
"sympy",
|
"sympy",
|
||||||
],
|
],
|
||||||
# To get file creator and type of Macintosh PostScript Type 1 fonts (macOS only)
|
# To get file creator and type of Macintosh PostScript Type 1 fonts (macOS only)
|
||||||
"type1": [
|
"type1": [
|
||||||
"xattr; sys_platform == 'darwin'",
|
"xattr; sys_platform == 'darwin'",
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
# use a special 'all' key as shorthand to includes all the extra dependencies
|
# use a special 'all' key as shorthand to includes all the extra dependencies
|
||||||
extras_require["all"] = sum(extras_require.values(), [])
|
extras_require["all"] = sum(extras_require.values(), [])
|
||||||
|
|
||||||
|
|
||||||
# Trove classifiers for PyPI
|
# Trove classifiers for PyPI
|
||||||
classifiers = {"classifiers": [
|
classifiers = {"classifiers": [
|
||||||
"Development Status :: 5 - Production/Stable",
|
"Development Status :: 5 - Production/Stable",
|
||||||
"Environment :: Console",
|
"Environment :: Console",
|
||||||
"Environment :: Other Environment",
|
"Environment :: Other Environment",
|
||||||
"Intended Audience :: Developers",
|
"Intended Audience :: Developers",
|
||||||
"Intended Audience :: End Users/Desktop",
|
"Intended Audience :: End Users/Desktop",
|
||||||
"License :: OSI Approved :: MIT License",
|
"License :: OSI Approved :: MIT License",
|
||||||
"Natural Language :: English",
|
"Natural Language :: English",
|
||||||
"Operating System :: OS Independent",
|
"Operating System :: OS Independent",
|
||||||
"Programming Language :: Python",
|
"Programming Language :: Python",
|
||||||
"Programming Language :: Python :: 2",
|
"Programming Language :: Python :: 2",
|
||||||
"Programming Language :: Python :: 3",
|
"Programming Language :: Python :: 3",
|
||||||
"Topic :: Text Processing :: Fonts",
|
"Topic :: Text Processing :: Fonts",
|
||||||
"Topic :: Multimedia :: Graphics",
|
"Topic :: Multimedia :: Graphics",
|
||||||
"Topic :: Multimedia :: Graphics :: Graphics Conversion",
|
"Topic :: Multimedia :: Graphics :: Graphics Conversion",
|
||||||
]}
|
]}
|
||||||
|
|
||||||
|
|
||||||
# concatenate README.rst and NEWS.rest into long_description so they are
|
# concatenate README.rst and NEWS.rest into long_description so they are
|
||||||
# displayed on the FontTols project page on PyPI
|
# displayed on the FontTols project page on PyPI
|
||||||
with io.open("README.rst", "r", encoding="utf-8") as readme:
|
with io.open("README.rst", "r", encoding="utf-8") as readme:
|
||||||
long_description = readme.read()
|
long_description = readme.read()
|
||||||
long_description += "\nChangelog\n~~~~~~~~~\n\n"
|
long_description += "\nChangelog\n~~~~~~~~~\n\n"
|
||||||
with io.open("NEWS.rst", "r", encoding="utf-8") as changelog:
|
with io.open("NEWS.rst", "r", encoding="utf-8") as changelog:
|
||||||
long_description += changelog.read()
|
long_description += changelog.read()
|
||||||
|
|
||||||
|
|
||||||
@contextlib.contextmanager
|
@contextlib.contextmanager
|
||||||
def capture_logger(name):
|
def capture_logger(name):
|
||||||
""" Context manager to capture a logger output with a StringIO stream.
|
""" Context manager to capture a logger output with a StringIO stream.
|
||||||
"""
|
"""
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
logger = logging.getLogger(name)
|
logger = logging.getLogger(name)
|
||||||
try:
|
try:
|
||||||
import StringIO
|
import StringIO
|
||||||
stream = StringIO.StringIO()
|
stream = StringIO.StringIO()
|
||||||
except ImportError:
|
except ImportError:
|
||||||
stream = io.StringIO()
|
stream = io.StringIO()
|
||||||
handler = logging.StreamHandler(stream)
|
handler = logging.StreamHandler(stream)
|
||||||
logger.addHandler(handler)
|
logger.addHandler(handler)
|
||||||
try:
|
try:
|
||||||
yield stream
|
yield stream
|
||||||
finally:
|
finally:
|
||||||
logger.removeHandler(handler)
|
logger.removeHandler(handler)
|
||||||
|
|
||||||
|
|
||||||
class release(Command):
|
class release(Command):
|
||||||
"""
|
"""
|
||||||
Tag a new release with a single command, using the 'bumpversion' tool
|
Tag a new release with a single command, using the 'bumpversion' tool
|
||||||
to update all the version strings in the source code.
|
to update all the version strings in the source code.
|
||||||
The version scheme conforms to 'SemVer' and PEP 440 specifications.
|
The version scheme conforms to 'SemVer' and PEP 440 specifications.
|
||||||
|
|
||||||
Firstly, the pre-release '.devN' suffix is dropped to signal that this is
|
Firstly, the pre-release '.devN' suffix is dropped to signal that this is
|
||||||
a stable release. If '--major' or '--minor' options are passed, the
|
a stable release. If '--major' or '--minor' options are passed, the
|
||||||
the first or second 'semver' digit is also incremented. Major is usually
|
the first or second 'semver' digit is also incremented. Major is usually
|
||||||
for backward-incompatible API changes, while minor is used when adding
|
for backward-incompatible API changes, while minor is used when adding
|
||||||
new backward-compatible functionalities. No options imply 'patch' or bug-fix
|
new backward-compatible functionalities. No options imply 'patch' or bug-fix
|
||||||
release.
|
release.
|
||||||
|
|
||||||
A new header is also added to the changelog file ("NEWS.rst"), containing
|
A new header is also added to the changelog file ("NEWS.rst"), containing
|
||||||
the new version string and the current 'YYYY-MM-DD' date.
|
the new version string and the current 'YYYY-MM-DD' date.
|
||||||
|
|
||||||
All changes are committed, and an annotated git tag is generated. With the
|
All changes are committed, and an annotated git tag is generated. With the
|
||||||
--sign option, the tag is GPG-signed with the user's default key.
|
--sign option, the tag is GPG-signed with the user's default key.
|
||||||
|
|
||||||
Finally, the 'patch' part of the version string is bumped again, and a
|
Finally, the 'patch' part of the version string is bumped again, and a
|
||||||
pre-release suffix '.dev0' is appended to mark the opening of a new
|
pre-release suffix '.dev0' is appended to mark the opening of a new
|
||||||
development cycle.
|
development cycle.
|
||||||
|
|
||||||
Links:
|
Links:
|
||||||
- http://semver.org/
|
- http://semver.org/
|
||||||
- https://www.python.org/dev/peps/pep-0440/
|
- https://www.python.org/dev/peps/pep-0440/
|
||||||
- https://github.com/c4urself/bump2version
|
- https://github.com/c4urself/bump2version
|
||||||
"""
|
"""
|
||||||
|
|
||||||
description = "update version strings for release"
|
description = "update version strings for release"
|
||||||
|
|
||||||
user_options = [
|
user_options = [
|
||||||
("major", None, "bump the first digit (incompatible API changes)"),
|
("major", None, "bump the first digit (incompatible API changes)"),
|
||||||
("minor", None, "bump the second digit (new backward-compatible features)"),
|
("minor", None, "bump the second digit (new backward-compatible features)"),
|
||||||
("sign", "s", "make a GPG-signed tag, using the default key"),
|
("sign", "s", "make a GPG-signed tag, using the default key"),
|
||||||
("allow-dirty", None, "don't abort if working directory is dirty"),
|
("allow-dirty", None, "don't abort if working directory is dirty"),
|
||||||
]
|
]
|
||||||
|
|
||||||
changelog_name = "NEWS.rst"
|
changelog_name = "NEWS.rst"
|
||||||
version_RE = re.compile("^[0-9]+\.[0-9]+")
|
version_RE = re.compile("^[0-9]+\.[0-9]+")
|
||||||
date_fmt = u"%Y-%m-%d"
|
date_fmt = u"%Y-%m-%d"
|
||||||
header_fmt = u"%s (released %s)"
|
header_fmt = u"%s (released %s)"
|
||||||
commit_message = "Release {new_version}"
|
commit_message = "Release {new_version}"
|
||||||
tag_name = "{new_version}"
|
tag_name = "{new_version}"
|
||||||
version_files = [
|
version_files = [
|
||||||
"setup.cfg",
|
"setup.cfg",
|
||||||
"setup.py",
|
"setup.py",
|
||||||
"Lib/fontTools/__init__.py",
|
"Lib/fontTools/__init__.py",
|
||||||
]
|
]
|
||||||
|
|
||||||
def initialize_options(self):
|
def initialize_options(self):
|
||||||
self.minor = False
|
self.minor = False
|
||||||
self.major = False
|
self.major = False
|
||||||
self.sign = False
|
self.sign = False
|
||||||
self.allow_dirty = False
|
self.allow_dirty = False
|
||||||
|
|
||||||
def finalize_options(self):
|
def finalize_options(self):
|
||||||
if all([self.major, self.minor]):
|
if all([self.major, self.minor]):
|
||||||
from distutils.errors import DistutilsOptionError
|
from distutils.errors import DistutilsOptionError
|
||||||
raise DistutilsOptionError("--major/--minor are mutually exclusive")
|
raise DistutilsOptionError("--major/--minor are mutually exclusive")
|
||||||
self.part = "major" if self.major else "minor" if self.minor else None
|
self.part = "major" if self.major else "minor" if self.minor else None
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
if self.part is not None:
|
if self.part is not None:
|
||||||
log.info("bumping '%s' version" % self.part)
|
log.info("bumping '%s' version" % self.part)
|
||||||
self.bumpversion(self.part, commit=False)
|
self.bumpversion(self.part, commit=False)
|
||||||
release_version = self.bumpversion(
|
release_version = self.bumpversion(
|
||||||
"release", commit=False, allow_dirty=True)
|
"release", commit=False, allow_dirty=True)
|
||||||
else:
|
else:
|
||||||
log.info("stripping pre-release suffix")
|
log.info("stripping pre-release suffix")
|
||||||
release_version = self.bumpversion("release")
|
release_version = self.bumpversion("release")
|
||||||
log.info(" version = %s" % release_version)
|
log.info(" version = %s" % release_version)
|
||||||
|
|
||||||
changes = self.format_changelog(release_version)
|
changes = self.format_changelog(release_version)
|
||||||
|
|
||||||
self.git_commit(release_version)
|
self.git_commit(release_version)
|
||||||
self.git_tag(release_version, changes, self.sign)
|
self.git_tag(release_version, changes, self.sign)
|
||||||
|
|
||||||
log.info("bumping 'patch' version and pre-release suffix")
|
log.info("bumping 'patch' version and pre-release suffix")
|
||||||
next_dev_version = self.bumpversion('patch', commit=True)
|
next_dev_version = self.bumpversion('patch', commit=True)
|
||||||
log.info(" version = %s" % next_dev_version)
|
log.info(" version = %s" % next_dev_version)
|
||||||
|
|
||||||
def git_commit(self, version):
|
def git_commit(self, version):
|
||||||
""" Stage and commit all relevant version files, and format the commit
|
""" Stage and commit all relevant version files, and format the commit
|
||||||
message with specified 'version' string.
|
message with specified 'version' string.
|
||||||
"""
|
"""
|
||||||
files = self.version_files + [self.changelog_name]
|
files = self.version_files + [self.changelog_name]
|
||||||
|
|
||||||
log.info("committing changes")
|
log.info("committing changes")
|
||||||
for f in files:
|
for f in files:
|
||||||
log.info(" %s" % f)
|
log.info(" %s" % f)
|
||||||
if self.dry_run:
|
if self.dry_run:
|
||||||
return
|
return
|
||||||
sp.check_call(["git", "add"] + files)
|
sp.check_call(["git", "add"] + files)
|
||||||
msg = self.commit_message.format(new_version=version)
|
msg = self.commit_message.format(new_version=version)
|
||||||
sp.check_call(["git", "commit", "-m", msg], stdout=sp.PIPE)
|
sp.check_call(["git", "commit", "-m", msg], stdout=sp.PIPE)
|
||||||
|
|
||||||
def git_tag(self, version, message, sign=False):
|
def git_tag(self, version, message, sign=False):
|
||||||
""" Create annotated git tag with given 'version' and 'message'.
|
""" Create annotated git tag with given 'version' and 'message'.
|
||||||
Optionally 'sign' the tag with the user's GPG key.
|
Optionally 'sign' the tag with the user's GPG key.
|
||||||
"""
|
"""
|
||||||
log.info("creating %s git tag '%s'" % (
|
log.info("creating %s git tag '%s'" % (
|
||||||
"signed" if sign else "annotated", version))
|
"signed" if sign else "annotated", version))
|
||||||
if self.dry_run:
|
if self.dry_run:
|
||||||
return
|
return
|
||||||
# create an annotated (or signed) tag from the new version
|
# create an annotated (or signed) tag from the new version
|
||||||
tag_opt = "-s" if sign else "-a"
|
tag_opt = "-s" if sign else "-a"
|
||||||
tag_name = self.tag_name.format(new_version=version)
|
tag_name = self.tag_name.format(new_version=version)
|
||||||
proc = sp.Popen(
|
proc = sp.Popen(
|
||||||
["git", "tag", tag_opt, "-F", "-", tag_name], stdin=sp.PIPE)
|
["git", "tag", tag_opt, "-F", "-", tag_name], stdin=sp.PIPE)
|
||||||
# use the latest changes from the changelog file as the tag message
|
# use the latest changes from the changelog file as the tag message
|
||||||
tag_message = u"%s\n\n%s" % (tag_name, message)
|
tag_message = u"%s\n\n%s" % (tag_name, message)
|
||||||
proc.communicate(tag_message.encode('utf-8'))
|
proc.communicate(tag_message.encode('utf-8'))
|
||||||
if proc.returncode != 0:
|
if proc.returncode != 0:
|
||||||
sys.exit(proc.returncode)
|
sys.exit(proc.returncode)
|
||||||
|
|
||||||
def bumpversion(self, part, commit=False, message=None, allow_dirty=None):
|
def bumpversion(self, part, commit=False, message=None, allow_dirty=None):
|
||||||
""" Run bumpversion.main() with the specified arguments, and return the
|
""" Run bumpversion.main() with the specified arguments, and return the
|
||||||
new computed version string (cf. 'bumpversion --help' for more info)
|
new computed version string (cf. 'bumpversion --help' for more info)
|
||||||
"""
|
"""
|
||||||
import bumpversion
|
import bumpversion
|
||||||
|
|
||||||
args = (
|
args = (
|
||||||
(['--verbose'] if self.verbose > 1 else []) +
|
(['--verbose'] if self.verbose > 1 else []) +
|
||||||
(['--dry-run'] if self.dry_run else []) +
|
(['--dry-run'] if self.dry_run else []) +
|
||||||
(['--allow-dirty'] if (allow_dirty or self.allow_dirty) else []) +
|
(['--allow-dirty'] if (allow_dirty or self.allow_dirty) else []) +
|
||||||
(['--commit'] if commit else ['--no-commit']) +
|
(['--commit'] if commit else ['--no-commit']) +
|
||||||
(['--message', message] if message is not None else []) +
|
(['--message', message] if message is not None else []) +
|
||||||
['--list', part]
|
['--list', part]
|
||||||
)
|
)
|
||||||
log.debug("$ bumpversion %s" % " ".join(a.replace(" ", "\\ ") for a in args))
|
log.debug("$ bumpversion %s" % " ".join(a.replace(" ", "\\ ") for a in args))
|
||||||
|
|
||||||
with capture_logger("bumpversion.list") as out:
|
with capture_logger("bumpversion.list") as out:
|
||||||
bumpversion.main(args)
|
bumpversion.main(args)
|
||||||
|
|
||||||
last_line = out.getvalue().splitlines()[-1]
|
last_line = out.getvalue().splitlines()[-1]
|
||||||
new_version = last_line.replace("new_version=", "")
|
new_version = last_line.replace("new_version=", "")
|
||||||
return new_version
|
return new_version
|
||||||
|
|
||||||
def format_changelog(self, version):
|
def format_changelog(self, version):
|
||||||
""" Write new header at beginning of changelog file with the specified
|
""" Write new header at beginning of changelog file with the specified
|
||||||
'version' and the current date.
|
'version' and the current date.
|
||||||
Return the changelog content for the current release.
|
Return the changelog content for the current release.
|
||||||
"""
|
"""
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
log.info("formatting changelog")
|
log.info("formatting changelog")
|
||||||
|
|
||||||
changes = []
|
changes = []
|
||||||
with io.open(self.changelog_name, "r+", encoding="utf-8") as f:
|
with io.open(self.changelog_name, "r+", encoding="utf-8") as f:
|
||||||
for ln in f:
|
for ln in f:
|
||||||
if self.version_RE.match(ln):
|
if self.version_RE.match(ln):
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
changes.append(ln)
|
changes.append(ln)
|
||||||
if not self.dry_run:
|
if not self.dry_run:
|
||||||
f.seek(0)
|
f.seek(0)
|
||||||
content = f.read()
|
content = f.read()
|
||||||
date = datetime.today().strftime(self.date_fmt)
|
date = datetime.today().strftime(self.date_fmt)
|
||||||
f.seek(0)
|
f.seek(0)
|
||||||
header = self.header_fmt % (version, date)
|
header = self.header_fmt % (version, date)
|
||||||
f.write(header + u"\n" + u"-"*len(header) + u"\n\n" + content)
|
f.write(header + u"\n" + u"-"*len(header) + u"\n\n" + content)
|
||||||
|
|
||||||
return u"".join(changes)
|
return u"".join(changes)
|
||||||
|
|
||||||
|
|
||||||
def find_data_files(manpath="share/man"):
|
def find_data_files(manpath="share/man"):
|
||||||
""" Find FontTools's data_files (just man pages at this point).
|
""" Find FontTools's data_files (just man pages at this point).
|
||||||
|
|
||||||
By default, we install man pages to "share/man" directory relative to the
|
By default, we install man pages to "share/man" directory relative to the
|
||||||
base installation directory for data_files. The latter can be changed with
|
base installation directory for data_files. The latter can be changed with
|
||||||
the --install-data option of 'setup.py install' sub-command.
|
the --install-data option of 'setup.py install' sub-command.
|
||||||
|
|
||||||
E.g., if the data files installation directory is "/usr", the default man
|
E.g., if the data files installation directory is "/usr", the default man
|
||||||
page installation directory will be "/usr/share/man".
|
page installation directory will be "/usr/share/man".
|
||||||
|
|
||||||
You can override this via the $FONTTOOLS_MANPATH environment variable.
|
You can override this via the $FONTTOOLS_MANPATH environment variable.
|
||||||
|
|
||||||
E.g., on some BSD systems man pages are installed to 'man' instead of
|
E.g., on some BSD systems man pages are installed to 'man' instead of
|
||||||
'share/man'; you can export $FONTTOOLS_MANPATH variable just before
|
'share/man'; you can export $FONTTOOLS_MANPATH variable just before
|
||||||
installing:
|
installing:
|
||||||
|
|
||||||
$ FONTTOOLS_MANPATH="man" pip install -v .
|
$ FONTTOOLS_MANPATH="man" pip install -v .
|
||||||
[...]
|
[...]
|
||||||
running install_data
|
running install_data
|
||||||
copying Doc/man/ttx.1 -> /usr/man/man1
|
copying Doc/man/ttx.1 -> /usr/man/man1
|
||||||
|
|
||||||
When installing from PyPI, for this variable to have effect you need to
|
When installing from PyPI, for this variable to have effect you need to
|
||||||
force pip to install from the source distribution instead of the wheel
|
force pip to install from the source distribution instead of the wheel
|
||||||
package (otherwise setup.py is not run), by using the --no-binary option:
|
package (otherwise setup.py is not run), by using the --no-binary option:
|
||||||
|
|
||||||
$ FONTTOOLS_MANPATH="man" pip install --no-binary=fonttools fonttools
|
$ FONTTOOLS_MANPATH="man" pip install --no-binary=fonttools fonttools
|
||||||
|
|
||||||
Note that you can only override the base man path, i.e. without the
|
Note that you can only override the base man path, i.e. without the
|
||||||
section number (man1, man3, etc.). The latter is always implied to be 1,
|
section number (man1, man3, etc.). The latter is always implied to be 1,
|
||||||
for "general commands".
|
for "general commands".
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# get base installation directory for man pages
|
# get base installation directory for man pages
|
||||||
manpagebase = os.environ.get('FONTTOOLS_MANPATH', convert_path(manpath))
|
manpagebase = os.environ.get('FONTTOOLS_MANPATH', convert_path(manpath))
|
||||||
# all our man pages go to section 1
|
# all our man pages go to section 1
|
||||||
manpagedir = pjoin(manpagebase, 'man1')
|
manpagedir = pjoin(manpagebase, 'man1')
|
||||||
|
|
||||||
manpages = [f for f in glob(pjoin('Doc', 'man', 'man1', '*.1')) if isfile(f)]
|
manpages = [f for f in glob(pjoin('Doc', 'man', 'man1', '*.1')) if isfile(f)]
|
||||||
|
|
||||||
data_files = [(manpagedir, manpages)]
|
data_files = [(manpagedir, manpages)]
|
||||||
return data_files
|
return data_files
|
||||||
|
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name="fonttools",
|
name="fonttools",
|
||||||
version="3.37.3.dev0",
|
version="3.37.3.dev0",
|
||||||
description="Tools to manipulate font files",
|
description="Tools to manipulate font files",
|
||||||
author="Just van Rossum",
|
author="Just van Rossum",
|
||||||
author_email="just@letterror.com",
|
author_email="just@letterror.com",
|
||||||
maintainer="Behdad Esfahbod",
|
maintainer="Behdad Esfahbod",
|
||||||
maintainer_email="behdad@behdad.org",
|
maintainer_email="behdad@behdad.org",
|
||||||
url="http://github.com/fonttools/fonttools",
|
url="http://github.com/fonttools/fonttools",
|
||||||
license="MIT",
|
license="MIT",
|
||||||
platforms=["Any"],
|
platforms=["Any"],
|
||||||
long_description=long_description,
|
long_description=long_description,
|
||||||
package_dir={'': 'Lib'},
|
package_dir={'': 'Lib'},
|
||||||
packages=find_packages("Lib"),
|
packages=find_packages("Lib"),
|
||||||
include_package_data=True,
|
include_package_data=True,
|
||||||
data_files=find_data_files(),
|
data_files=find_data_files(),
|
||||||
setup_requires=wheel + bumpversion,
|
setup_requires=wheel + bumpversion,
|
||||||
extras_require=extras_require,
|
extras_require=extras_require,
|
||||||
entry_points={
|
entry_points={
|
||||||
'console_scripts': [
|
'console_scripts': [
|
||||||
"fonttools = fontTools.__main__:main",
|
"fonttools = fontTools.__main__:main",
|
||||||
"ttx = fontTools.ttx:main",
|
"ttx = fontTools.ttx:main",
|
||||||
"pyftsubset = fontTools.subset:main",
|
"pyftsubset = fontTools.subset:main",
|
||||||
"pyftmerge = fontTools.merge:main",
|
"pyftmerge = fontTools.merge:main",
|
||||||
"pyftinspect = fontTools.inspect:main"
|
"pyftinspect = fontTools.inspect:main"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
cmdclass={
|
cmdclass={
|
||||||
"release": release,
|
"release": release,
|
||||||
},
|
},
|
||||||
**classifiers
|
**classifiers
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user