Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
jcwinkler committed Nov 27, 2020
2 parents 576874f + ea02c6e commit 5eb6bb8
Show file tree
Hide file tree
Showing 84 changed files with 24,489 additions and 30 deletions.
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ matrix:
- python3-gi-cairo
- gir1.2-gtk-3.0
- texlive-latex-base
- texlive-fonts-recommended
- texlive-lang-cyrillic
- cm-super
- libxml2-utils
env:
- RELEASE_MAKER=true
Expand Down
16 changes: 16 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
Version 1.3.0 (2020-11-27)
~~~~~~~~~~~~~~~~~~~~~~~~~~
- Fixed: Double backslashes and missing line breaks occur when using
TexText 1.2.0 on nodes created with TexText <= 1.1 (:issue_num:`265`)

**Note: A one-time manual insertion of line breaks will be necessary
when opening such nodes. When having saved them again the line breaks
are kept in the future. Double backslashes are replaced by single ones
automatically.**
- Fixed: Opening TexText is slow (:issue_num:`263`)
- Fixed: Windows installation script complains about missing
Python GTK3 bindings (:issue_num:`262`)
- New: Added explanation to the FAQ/ documentation how to
define a shortcut for opening TexText (:issue_num:`259`). Refer to
https://textext.github.io/textext/usage/faq.html#defining-keyboard-shortcut-for-opening-textext-dialog

Version 1.2.0 (2020-10-22)
~~~~~~~~~~~~~~~~~~~~~~~~~~
- Fixed: On Windows and Inkscape 1.0.1 TK interface is shown only
Expand Down
33 changes: 21 additions & 12 deletions pytests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import glob
import os

# List of specific test cases to be run, e.g. ["07", "08"].
# To run all tests set to empty list []
SPECIFIC_TESTS = []


def pytest_generate_tests(metafunc):
if (
Expand All @@ -16,18 +20,23 @@ def pytest_generate_tests(metafunc):
ids = []
for inkscape_version in inkscape_versions:
for folder, _, files in os.walk(inkscape_version):
if "config.json" in files and \
"original.svg" in files and \
"modified.svg" in files:
textext_version = os.path.dirname(os.path.dirname(folder))
converter = os.path.dirname(folder)
args.append([path_to_snippets,
os.path.basename(inkscape_version),
os.path.basename(textext_version),
os.path.basename(converter),
os.path.basename(folder)
])
ids.append(os.path.relpath(folder, path_to_snippets))
test_case = os.path.basename(folder)
if len(SPECIFIC_TESTS) == 0 or test_case in SPECIFIC_TESTS:
if "config.json" in files and \
"original.svg" in files and \
"modified.svg" in files:
textext_version = os.path.dirname(os.path.dirname(folder))
converter = os.path.dirname(folder)
args.append([path_to_snippets,
os.path.basename(inkscape_version),
os.path.basename(textext_version),
os.path.basename(converter),
test_case
])
ids.append(os.path.relpath(folder, path_to_snippets))

assert (len(ids) > 0), "No valid test case(s) defined"

args_with_ids = sorted(list(zip(args,ids)))
args, ids = zip(*args_with_ids)
metafunc.parametrize(["root", "inkscape_version", "textext_version", "converter", "test_case"], args, ids=ids)
7 changes: 4 additions & 3 deletions pytests/test_compatibility.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@ def images_are_same(png1, png2, fuzz="0%", size_abs_tol=10, size_rel_tol=0.005,
im1.resize((w, h), PIL.Image.LANCZOS).save(png1)
im2.resize((w, h), PIL.Image.LANCZOS).save(png2)

proc = subprocess.Popen(COMPARE_EXE + ["-metric", "ae", "-fuzz", fuzz, png1, png2,
proc = subprocess.Popen(COMPARE_EXE + ["-channel", "rgba", "-metric", "ae",
"-fuzz", fuzz, png1, png2,
os.devnull if RESULTS_INTO_TEMPDIR else
os.path.join(os.path.dirname(png1), "diff.png")],
stderr=subprocess.PIPE, stdout=subprocess.PIPE)
Expand Down Expand Up @@ -171,7 +172,7 @@ def is_current_version_compatible(test_id,
png1 = os.path.join(tmp_dir, "1.png")
png2 = os.path.join(tmp_dir, "2.png")

config = json.load(open(json_config))
config = json.load(open(json_config, encoding="utf-8"))
check_render = config["check"]["render"]

render_options = {}
Expand Down Expand Up @@ -219,7 +220,7 @@ def is_current_version_compatible(test_id,
r"--scale-factor=%f" % mod_args["scale-factor"],
r"--preamble-file=%s" % mod_args["preamble-file"],
r"--alignment=%s" % mod_args["alignment"],
svg_original])
svg_original], output=os.devnull)

svg2 = os.path.join(tmp_dir, "svg2.svg")

Expand Down
29 changes: 29 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import sys
import stat
import tempfile
import fnmatch

from textext.requirements_check import \
set_logging_levels, \
Expand All @@ -20,6 +21,15 @@
from textext.utility import Settings


# Hotfix for Inkscape 1.0.1 on Windows: HarfBuzz-0.0.typelib is missing
# in the Inkscape installation Python subsystem, hence we ship
# it manually and set the search path accordingly here
# ToDo: Remove this hotfix when Inkscape 1.0.2 is released and mark
# Inkscape 1.0.1 as incompatible with TexText
if os.name == "nt":
os.environ['GI_TYPELIB_PATH'] = os.path.abspath(os.path.join(os.path.dirname(__file__), "textext"))


# taken from https://stackoverflow.com/a/3041990/1741477
def query_yes_no(question, default="yes"):
"""Ask a yes/no question via raw_input() and return their answer.
Expand Down Expand Up @@ -114,6 +124,21 @@ class CopyFileAlreadyExistsError(RuntimeError):
pass


_ignore_patterns = [
'__pycache__',
'*.pyc',
'*.log',
]


def is_ignored(filename):
for pattern in _ignore_patterns:
if fnmatch.fnmatch(filename, pattern):
return True

return False


def copy_extension_files(src, dst, if_already_exists="raise"):
"""
src: glob expresion to copy from
Expand All @@ -131,6 +156,10 @@ def copy_extension_files(src, dst, if_already_exists="raise"):
for file in glob.glob(src):
basename = os.path.basename(file)
destination = os.path.join(dst, basename)

if is_ignored(basename):
continue

if os.path.exists(destination):
if if_already_exists == "raise":
logger.critical("Can't copy `%s`: `%s` already exists" % (file, destination))
Expand Down
Loading

0 comments on commit 5eb6bb8

Please sign in to comment.