Skip to content

Commit

Permalink
Move mwparserfromhell to src/ dir
Browse files Browse the repository at this point in the history
  • Loading branch information
earwig committed Jan 4, 2021
1 parent 074e368 commit 297bcb0
Show file tree
Hide file tree
Showing 53 changed files with 24 additions and 20 deletions.
5 changes: 3 additions & 2 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
v0.7 (unreleased):

- Port tests to pytest. (#237)
- Improve parsing of external links. (#232)
- Improved parsing of external links. (#232)
- Ported tests to pytest. (#237)
- Moved mwparserfromhell package to src/ dir.

v0.6 (released December 21, 2020):

Expand Down
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
include LICENSE CHANGELOG
recursive-include mwparserfromhell *.h
recursive-include src *.h
recursive-include tests *.py *.mwtest
7 changes: 4 additions & 3 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ v0.7
Unreleased
(`changes <https://github.com/earwig/mwparserfromhell/compare/v0.6...develop>`__):

- Port tests to pytest.
(`#237 <https://github.com/earwig/mwparserfromhell/issues/237>`_)
- Improve parsing of external links.
- Improved parsing of external links.
(`#232 <https://github.com/earwig/mwparserfromhell/issues/232>`_)
- Ported tests to pytest.
(`#237 <https://github.com/earwig/mwparserfromhell/issues/237>`_)
- Moved mwparserfromhell package to src/ dir.

v0.6
----
Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@

# General information about the project.
project = u'mwparserfromhell'
copyright = u'2012–2020 Ben Kurtovic'
copyright = u'2012–2021 Ben Kurtovic'

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
Expand Down
22 changes: 12 additions & 10 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,15 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

from distutils.errors import DistutilsError, CCompilerError
from glob import glob
from os import environ
import os
import sys

from setuptools import setup, find_packages, Extension
from setuptools import setup, Extension
from setuptools.command.build_ext import build_ext

sys.path.insert(0, os.path.join(os.path.dirname(__file__), "src"))

from mwparserfromhell import __version__

with open("README.rst") as fp:
Expand All @@ -38,7 +39,7 @@

# Allow env var WITHOUT_EXTENSION and args --with[out]-extension:

env_var = environ.get("WITHOUT_EXTENSION")
env_var = os.environ.get("WITHOUT_EXTENSION")
if "--without-extension" in sys.argv:
use_extension = False
elif "--with-extension" in sys.argv:
Expand All @@ -52,12 +53,12 @@
# Remove the command line argument as it isn't understood by setuptools:

sys.argv = [arg for arg in sys.argv
if arg != "--without-extension" and arg != "--with-extension"]
if arg not in ("--without-extension", "--with-extension")]

def build_ext_patched(self):
try:
build_ext_original(self)
except (DistutilsError, CCompilerError) as exc:
except Exception as exc:
print("error: " + str(exc))
print("Falling back to pure Python mode.")
del self.extensions[:]
Expand All @@ -68,14 +69,15 @@ def build_ext_patched(self):
# Project-specific part begins here:

tokenizer = Extension("mwparserfromhell.parser._tokenizer",
sources=sorted(glob("mwparserfromhell/parser/ctokenizer/*.c")),
depends=sorted(glob("mwparserfromhell/parser/ctokenizer/*.h")))
sources=sorted(glob("src/mwparserfromhell/parser/ctokenizer/*.c")),
depends=sorted(glob("src/mwparserfromhell/parser/ctokenizer/*.h")))

setup(
name = "mwparserfromhell",
packages = find_packages(exclude=("tests",)),
packages = ["mwparserfromhell"],
package_dir = {"": "src"},
ext_modules = [tokenizer] if use_extension else [],
test_requires = ["pytest"],
tests_require = ["pytest"],
version = __version__,
python_requires = ">= 3.5",
author = "Ben Kurtovic",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (C) 2012-2020 Ben Kurtovic <[email protected]>
# Copyright (C) 2012-2021 Ben Kurtovic <[email protected]>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
Expand All @@ -25,7 +25,7 @@
"""

__author__ = "Ben Kurtovic"
__copyright__ = "Copyright (C) 2012-2020 Ben Kurtovic"
__copyright__ = "Copyright (C) 2012-2021 Ben Kurtovic"
__license__ = "MIT License"
__version__ = "0.7.dev0"
__email__ = "[email protected]"
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (C) 2012-2020 Ben Kurtovic <[email protected]>
# Copyright (C) 2012-2021 Ben Kurtovic <[email protected]>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
Expand Down

0 comments on commit 297bcb0

Please sign in to comment.