Skip to content

Commit 7cc5f91

Browse files
Merge pull request #21 from source-foundry/py3
Python 3 updates, eliminate Python 2.7 support
2 parents caa559f + 9813c70 commit 7cc5f91

File tree

11 files changed

+211
-107
lines changed

11 files changed

+211
-107
lines changed

.travis.yml

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,24 @@ sudo: false
44
language: python
55
matrix:
66
include:
7-
- python: 2.7
8-
env: TOX_ENV=py27
9-
- python: 2.7
10-
env: TOX_ENV=py34
7+
- python: 3.7
8+
dist: xenial
9+
env: TOX_ENV=lint
10+
install: pip install flake8
11+
script: flake8 --ignore=E501,W503 lib/fontline/*.py
1112
- python: 3.5
1213
env: TOX_ENV=py35
14+
install: pip install tox
15+
script: tox -e $TOX_ENV
1316
- python: 3.6
1417
env: TOX_ENV=py36
15-
16-
script: tox -e $TOX_ENV
17-
18-
install:
19-
- pip install tox
18+
install: pip install tox
19+
script: tox -e $TOX_ENV
20+
- python: 3.7
21+
env: TOX_ENV=py37
22+
install: pip install tox
23+
dist: xenial
24+
script: tox -e $TOX_ENV
2025

2126
notifications:
2227
email: false

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
## Changelog
22

3+
### v2.0.0
4+
5+
- changed copyright notice from "Christopher Simpkins" to "Source Foundry Authors"
6+
- eliminated Python 2 interpreter support
7+
- updated shebang lines to `#!/usr/bin/env python3`
8+
- black formatting for source files
9+
- refactored Travis CI settings file
10+
- modified Travis CI testing to Python 3.5 - 3.7
11+
- refactored Appveyor CI settings file
12+
- modified Appveyor CI testing to Python 3.5 - 3.7
13+
-
14+
315
### v1.0.1
416

517
- removed unused variables in commands module

README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33

44
[![PyPI](https://img.shields.io/pypi/v/font-line.svg)](https://pypi.org/project/font-line)
5-
[![Build Status](https://semaphoreci.com/api/v1/sourcefoundry/font-line/branches/master/badge.svg)](https://semaphoreci.com/sourcefoundry/font-line)
5+
[![Build Status](https://travis-ci.org/source-foundry/font-line.svg?branch=master)](https://travis-ci.org/source-foundry/font-line)
66
[![Build status](https://ci.appveyor.com/api/projects/status/2s4725o5mxh2298c/branch/master?svg=true)](https://ci.appveyor.com/project/chrissimpkins/font-line/branch/master)
77
[![codecov.io](https://codecov.io/github/source-foundry/font-line/coverage.svg?branch=master)](https://codecov.io/github/source-foundry/font-line?branch=master)
8-
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/38f100cc1ef74d568e1bab02ac162cbb)](https://app.codacy.com/app/SourceFoundry/font-line)
8+
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/d77b55866c794a5a9dd3b3dfea9ec318)](https://www.codacy.com/app/SourceFoundry/font-line)
99

1010
## About
1111
font-line is a libre, open source command line tool for OpenType vertical metrics reporting and command line based font line spacing modifications. It supports `.ttf` and `.otf` font builds.
@@ -21,17 +21,17 @@ font-line is a libre, open source command line tool for OpenType vertical metric
2121

2222
## Quickstart
2323

24-
- Install: `$ pip install font-line`
24+
- Install: `$ pip3 install font-line`
2525
- Metrics Report: `$ font-line report [font path]`
2626
- Modify line spacing: `$ font-line percent [integer %] [font path]`
2727
- Help: `$ font-line --help`
2828

2929
## Install
3030

31-
font-line is built with Python and is tested with Python 2.7 and Python 3.4+ interpreters. You can verify your installed Python version on the command line with the command:
31+
font-line is built with Python and is tested with Python 3.5+ interpreters. You can verify your installed Python version on the command line with the command:
3232

3333
```
34-
$ python --version
34+
$ python3 --version
3535
```
3636

3737
Use either of the following methods to install font-line on your system.
@@ -41,10 +41,10 @@ Use either of the following methods to install font-line on your system.
4141
The latest font-line release is available through the Python Package Index and can be installed with pip:
4242

4343
```
44-
$ pip install font-line
44+
$ pip3 install font-line
4545
```
4646

47-
To upgrade to a new version of font-line after a pip install, use the command `pip install --upgrade font-line`.
47+
To upgrade to a new version of font-line after a pip install, use the command `pip3 install --upgrade font-line`.
4848

4949
### Download Project Repository and Install
5050

@@ -57,7 +57,7 @@ git clone https://github.com/source-foundry/font-line.git
5757
Navigate to the top level repository directory and enter the following command:
5858

5959
```
60-
$ python setup.py install
60+
$ pip3 install .
6161
```
6262

6363
Follow the same instructions to upgrade to a new version of the application if you install with this approach.
@@ -237,7 +237,7 @@ Please [submit a new issue report](https://github.com/source-foundry/font-line/i
237237

238238
## Acknowledgments
239239

240-
font-line is built with the fantastic [fontTools](https://github.com/behdad/fonttools) Python library.
240+
font-line is built with the fantastic [fontTools](https://github.com/fonttools/fonttools) Python library.
241241

242242

243243
## License

appveyor.yml

Lines changed: 43 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,46 @@
1-
build: false
21
environment:
32
matrix:
4-
- TOXENV: py27
5-
- TOXENV: py34
6-
- TOXENV: py35
7-
- TOXENV: py36
8-
platform:
9-
- x86
10-
- x64
11-
init:
12-
- "ECHO %TOXENV%"
13-
- ps: "ls C:\\Python*"
3+
- JOB: "3.5 64-bit"
4+
PYTHON_HOME: "C:\\Python35-x64"
5+
TOX_PY: py35
6+
7+
- JOB: "3.6 64-bit"
8+
PYTHON_HOME: "C:\\Python36-x64"
9+
TOX_PY: py36
10+
11+
- JOB: "3.7 64-bit"
12+
PYTHON_HOME: "C:\\Python37-x64"
13+
TOX_PY: py37
14+
15+
- JOB: "3.7 32-bit"
16+
PYTHON_HOME: "C:\\Python37"
17+
TOX_PY: py37
18+
1419
install:
15-
- "c:\\python27\\Scripts\\pip install tox"
16-
test_script:
17-
- "git clean -f -d -x"
18-
- "c:\\python27\\Scripts\\tox --version"
19-
- "c:\\python27\\Scripts\\pip --version"
20-
- "c:\\python27\\Scripts\\tox"
20+
# If there is a newer build queued for the same PR, cancel this one.
21+
# The AppVeyor 'rollout builds' option is supposed to serve the same
22+
# purpose but it is problematic because it tends to cancel builds pushed
23+
# directly to master instead of just PR builds (or the converse).
24+
# credits: JuliaLang developers.
25+
- ps: if ($env:APPVEYOR_PULL_REQUEST_NUMBER -and $env:APPVEYOR_BUILD_NUMBER -ne ((Invoke-RestMethod `
26+
https://ci.appveyor.com/api/projects/$env:APPVEYOR_ACCOUNT_NAME/$env:APPVEYOR_PROJECT_SLUG/history?recordsNumber=50).builds | `
27+
Where-Object pullRequestId -eq $env:APPVEYOR_PULL_REQUEST_NUMBER)[0].buildNumber) { `
28+
throw "There are newer queued builds for this pull request, failing early." }
29+
30+
# Prepend Python to the PATH of this build
31+
- "SET PATH=%PYTHON_HOME%;%PYTHON_HOME%\\Scripts;%PATH%"
32+
33+
# check that we have the expected version and architecture for Python
34+
- "python --version"
35+
- "python -c \"import struct; print(struct.calcsize('P') * 8)\""
36+
37+
# upgrade pip and setuptools to avoid out-of-date warnings
38+
- "python -m pip install --disable-pip-version-check --user --upgrade pip setuptools"
39+
40+
# install the test dependencies
41+
- "python -m pip install tox"
42+
43+
build: false
44+
45+
test_script:
46+
- "tox -e %TOX_PY%"

docs/LICENSE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2018 Christopher Simpkins
3+
Copyright (c) 2018 Source Foundry Authors
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy of
66
this software and associated documentation files (the "Software"), to deal in

docs/README.rst

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,21 +33,19 @@ Contents
3333
Quickstart
3434
~~~~~~~~~~
3535

36-
- Install: ``$ pip install font-line``
36+
- Install: ``$ pip3 install font-line``
3737
- Metrics Report: ``$ font-line report [font path]``
3838
- Modify line spacing: ``$font-line percent [integer %] [font path]``
3939

4040
Install
4141
~~~~~~~
4242

43-
font-line is built with Python and can be used on systems with Python
44-
2.7+ and Python 3.3+ interpreters, including current releases of pypy
45-
and pypy3. You can verify your installed Python version on the command
43+
font-line is built with Python and can be used on systems with Python 3.5+ interpreters. You can verify your installed Python version on the command
4644
line with the command:
4745

4846
::
4947

50-
$ python --version
48+
$ python3 --version
5149

5250
Use either of the following methods to install font-line on your system.
5351

@@ -59,10 +57,10 @@ Index and can be installed with pip:
5957

6058
::
6159

62-
$ pip install font-line
60+
$ pip3 install font-line
6361

6462
To upgrade to a new version of font-line after a pip install, use the
65-
command ``pip install --upgrade font-line``.
63+
command ``pip3 install --upgrade font-line``.
6664

6765
Download Project Repository and Install
6866
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -81,7 +79,7 @@ command:
8179

8280
::
8381

84-
$ python setup.py install
82+
$ pip3 install .
8583

8684
Follow the same instructions to upgrade to a new version of the
8785
application if you elect to install with this approach.
@@ -325,7 +323,7 @@ Acknowledgments
325323
~~~~~~~~~~~~~~~
326324

327325
font-line is built with the fantastic
328-
`fontTools <https://github.com/behdad/fonttools>`__ Python library.
326+
`fontTools <https://github.com/fonttools/fonttools>`__ Python library.
329327

330328
.. |Build Status| image:: https://semaphoreci.com/api/v1/sourcefoundry/font-line/branches/master/badge.svg
331329
:target: https://semaphoreci.com/sourcefoundry/font-line

lib/fontline/__init__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,2 @@
11
#!/usr/bin/env python
22
# -*- coding: utf-8 -*-
3-
4-

lib/fontline/app.py

Lines changed: 63 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python3
22
# -*- coding: utf-8 -*-
33

44
"""
@@ -14,7 +14,11 @@
1414
from standardstreams import stdout, stderr
1515

1616
from fontline import settings
17-
from fontline.commands import get_font_report, modify_linegap_percent, get_linegap_percent_filepath
17+
from fontline.commands import (
18+
get_font_report,
19+
modify_linegap_percent,
20+
get_linegap_percent_filepath,
21+
)
1822
from fontline.utilities import file_exists, is_supported_filetype
1923

2024
# TODO: support integer addition and subtraction to the metrics values through new sub-commands
@@ -27,7 +31,9 @@ def main():
2731
c = Command()
2832

2933
if c.does_not_validate_missing_args():
30-
stderr("[font-line] ERROR: Please include one or more arguments with your command.")
34+
stderr(
35+
"[font-line] ERROR: Please include one or more arguments with your command."
36+
)
3137
sys.exit(1)
3238

3339
if c.is_help_request():
@@ -43,7 +49,9 @@ def main():
4349
# REPORT sub-command
4450
if c.subcmd == "report":
4551
if c.argc < 2:
46-
stderr("[font-line] ERROR: Missing file path argument(s) after the report subcommand.")
52+
stderr(
53+
"[font-line] ERROR: Missing file path argument(s) after the report subcommand."
54+
)
4755
sys.exit(1)
4856
else:
4957
for fontpath in c.argv[1:]:
@@ -53,9 +61,17 @@ def main():
5361
if is_supported_filetype(fontpath):
5462
stdout(get_font_report(fontpath))
5563
else:
56-
stderr("[font-line] ERROR: '" + fontpath + "' does not appear to be a supported font file type.")
64+
stderr(
65+
"[font-line] ERROR: '"
66+
+ fontpath
67+
+ "' does not appear to be a supported font file type."
68+
)
5769
else:
58-
stderr("[font-line] ERROR: '" + fontpath + "' does not appear to be a valid filepath.")
70+
stderr(
71+
"[font-line] ERROR: '"
72+
+ fontpath
73+
+ "' does not appear to be a valid filepath."
74+
)
5975
# PERCENT sub-command
6076
elif c.subcmd == "percent":
6177
if c.argc < 3:
@@ -65,29 +81,59 @@ def main():
6581
percent = c.argv[1]
6682
# test the percent integer argument
6783
try:
68-
percent_int = int(percent) # test that the argument can be cast to an integer value
84+
percent_int = int(
85+
percent
86+
) # test that the argument can be cast to an integer value
6987
if percent_int <= 0:
70-
stderr("[font-line] ERROR: Please enter a percent value that is greater than zero.")
88+
stderr(
89+
"[font-line] ERROR: Please enter a percent value that is greater than zero."
90+
)
7191
sys.exit(1)
7292
if percent_int > 100:
73-
stdout("[font-line] Warning: You entered a percent value over 100%. Please confirm that this is "
74-
"your intended metrics modification.")
93+
stdout(
94+
"[font-line] Warning: You entered a percent value over 100%. Please confirm that this is "
95+
"your intended metrics modification."
96+
)
7597
except ValueError:
76-
stderr("[font-line] ERROR: You entered '" + percent + "'. This argument needs to be an integer value.")
98+
stderr(
99+
"[font-line] ERROR: You entered '"
100+
+ percent
101+
+ "'. This argument needs to be an integer value."
102+
)
77103
sys.exit(1)
78104
for fontpath in c.argv[2:]:
79105
if file_exists(fontpath):
80106
if is_supported_filetype(fontpath):
81107
if modify_linegap_percent(fontpath, percent) is True:
82108
outpath = get_linegap_percent_filepath(fontpath, percent)
83-
stdout("[font-line] '" + fontpath + "' successfully modified to '" + outpath + "'.")
109+
stdout(
110+
"[font-line] '"
111+
+ fontpath
112+
+ "' successfully modified to '"
113+
+ outpath
114+
+ "'."
115+
)
84116
else: # pragma: no cover
85-
stderr("[font-line] ERROR: Unsuccessful modification of '" + fontpath + "'.")
117+
stderr(
118+
"[font-line] ERROR: Unsuccessful modification of '"
119+
+ fontpath
120+
+ "'."
121+
)
86122
else:
87-
stderr("[font-line] ERROR: '" + fontpath + "' does not appear to be a supported font file type.")
123+
stderr(
124+
"[font-line] ERROR: '"
125+
+ fontpath
126+
+ "' does not appear to be a supported font file type."
127+
)
88128
else:
89-
stderr("[font-line] ERROR: '" + fontpath + "' does not appear to be a valid filepath.")
129+
stderr(
130+
"[font-line] ERROR: '"
131+
+ fontpath
132+
+ "' does not appear to be a valid filepath."
133+
)
90134
else:
91-
stderr("[font-lines] ERROR: You used an unsupported argument to the executable. Please review the"
92-
" `font-line --help` documentation and try again.")
135+
stderr(
136+
"[font-lines] ERROR: You used an unsupported argument to the executable. Please review the"
137+
" `font-line --help` documentation and try again."
138+
)
93139
sys.exit(1)

0 commit comments

Comments
 (0)