Ver código fonte

Merge 5e9930b8a0 into 94b6557d00

pull/79/merge
Merlijn van Deen 10 anos atrás
pai
commit
642c9ddc5b
4 arquivos alterados com 52 adições e 4 exclusões
  1. +2
    -0
      .gitignore
  2. +4
    -1
      README.rst
  3. +3
    -3
      tests/_test_tokenizer.py
  4. +43
    -0
      tools/build_mwpfh.py

+ 2
- 0
.gitignore Ver arquivo

@@ -1,4 +1,5 @@
*.pyc
*.pyd
*.so
*.dll
*.egg
@@ -8,3 +9,4 @@ __pycache__
build
dist
docs/_build
tools/*.log

+ 4
- 1
README.rst Ver arquivo

@@ -17,7 +17,10 @@ Installation

The easiest way to install the parser is through the `Python Package Index`_,
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
cd mwparserfromhell


+ 3
- 3
tests/_test_tokenizer.py Ver arquivo

@@ -25,6 +25,8 @@ from os import listdir, path
import sys

from mwparserfromhell.compat import py3k
if not py3k:
from codecs import open
from mwparserfromhell.parser import tokens

class _TestParseError(Exception):
@@ -109,10 +111,8 @@ class TokenizerTestCase(object):
def build(cls):
"""Load and install all tests from the 'tokenizer' directory."""
def load_file(filename):
with open(filename, "rU") as fp:
with open(filename, "rU", encoding='utf8') as fp:
text = fp.read()
if not py3k:
text = text.decode("utf8")
name = path.split(filename)[1][:0-len(extension)]
cls._load_tests(filename, name, text)



+ 43
- 0
tools/build_mwpfh.py Ver arquivo

@@ -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)

Carregando…
Cancelar
Salvar