@@ -1,4 +1,5 @@ | |||||
*.pyc | *.pyc | ||||
*.pyd | |||||
*.so | *.so | ||||
*.dll | *.dll | ||||
*.egg | *.egg | ||||
@@ -8,3 +9,4 @@ __pycache__ | |||||
build | build | ||||
dist | dist | ||||
docs/_build | docs/_build | ||||
tools/*.log |
@@ -17,7 +17,10 @@ Installation | |||||
The easiest way to install the parser is through the `Python Package Index`_, | The easiest way to install the parser is through the `Python Package Index`_, | ||||
so you can install the latest release with ``pip install mwparserfromhell`` | so you can install the latest release with ``pip install mwparserfromhell`` | ||||
(`get pip`_). Alternatively, get the latest development version:: | |||||
(`get pip`_). On Windows, make sure you have the latest version of pip | |||||
installed by running `pip install --upgrade pip`. | |||||
Alternatively, get the latest development version:: | |||||
git clone https://github.com/earwig/mwparserfromhell.git | git clone https://github.com/earwig/mwparserfromhell.git | ||||
cd mwparserfromhell | cd mwparserfromhell | ||||
@@ -25,6 +25,8 @@ from os import listdir, path | |||||
import sys | import sys | ||||
from mwparserfromhell.compat import py3k | from mwparserfromhell.compat import py3k | ||||
if not py3k: | |||||
from codecs import open | |||||
from mwparserfromhell.parser import tokens | from mwparserfromhell.parser import tokens | ||||
class _TestParseError(Exception): | class _TestParseError(Exception): | ||||
@@ -109,10 +111,8 @@ class TokenizerTestCase(object): | |||||
def build(cls): | def build(cls): | ||||
"""Load and install all tests from the 'tokenizer' directory.""" | """Load and install all tests from the 'tokenizer' directory.""" | ||||
def load_file(filename): | def load_file(filename): | ||||
with open(filename, "rU") as fp: | |||||
with open(filename, "rU", encoding='utf8') as fp: | |||||
text = fp.read() | text = fp.read() | ||||
if not py3k: | |||||
text = text.decode("utf8") | |||||
name = path.split(filename)[1][:0-len(extension)] | name = path.split(filename)[1][:0-len(extension)] | ||||
cls._load_tests(filename, name, text) | cls._load_tests(filename, name, text) | ||||
@@ -0,0 +1,43 @@ | |||||
from __future__ import print_function | |||||
import subprocess | |||||
import sys | |||||
import os | |||||
path = os.path.split(__file__)[0] | |||||
if path: | |||||
os.chdir(path) | |||||
environments = ['26', '27', '32', '33', '34'] | |||||
target = "pypi" if "--push" in sys.argv else "test" | |||||
returnvalues = {} | |||||
def run(pyver, cmds, target=None): | |||||
cmd = [r"C:\Python%s\Python.exe" % pyver, "setup.py"] + cmds | |||||
if target: | |||||
cmd += ["-r", target] | |||||
print(" ".join(cmd), end=" ") | |||||
retval = subprocess.call(cmd, stdout=open("%s%s.log" % (cmds[0], pyver), 'w'), stderr=subprocess.STDOUT, cwd="..") | |||||
if not retval: | |||||
print("[OK]") | |||||
else: | |||||
print("[FAILED (%i)]" % retval) | |||||
return retval | |||||
run("27", ["register"], target) | |||||
if 'failed' in open('register27.log').read(): | |||||
raise Exception | |||||
for pyver in environments: | |||||
print() | |||||
try: | |||||
os.unlink('mwparserfromhell/parser/_tokenizer.pyd') | |||||
except WindowsError: | |||||
pass | |||||
if run(pyver, ["test"]) == 0: | |||||
run(pyver, ["bdist_wheel", "upload"], target) |