diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a47c27d --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +*.egg-info/ +*.pyc +.tox/ +__pycache__ diff --git a/readme.md b/README.md similarity index 52% rename from readme.md rename to README.md index a89bcb4..2cd1ff9 100644 --- a/readme.md +++ b/README.md @@ -1,5 +1,5 @@ # Python PHP -Have you ever wished that the Python standard library had the power and flexibilty of PHP? Now it is as simple as `import php` +Have you ever wished that the Python standard library had the power and flexibility of PHP? Now it is as simple as `import php` ## Installation Python PHP can be installed using pip @@ -18,10 +18,12 @@ php.str_replace('Python', 'PHP', 'Hello World of Python') Python PHP supports the following types: int, string, list, and dictionaries ## Testing -Of course Python-PHP has unit tests! How else would we know that it is safe to use? Run tests with `$ python tests.py` +Of course Python-PHP has unit tests! How else would we know that it is safe to use? +Run tests with `$ python tests.py` +To test with python 2.6+ and 3.3+ type `$ tox` ## Compatibility -Python-PHP is currently only compatible with Python 2.7 +Python-PHP is compatible with all relevant Python versions: 2.6, 2.7, 3.3, 3.4 and 3.5 -## Is this really a good idea -What could possibly go wrong? +## Is this really a good idea? +What could possibly go wrong? OK, probably a lot of things. First release on April Fools Day 2016, this project was designed as a tongue-in-cheek coding exercise intended more for mirth than productivity. Using this in production is probably a very bad idea. diff --git a/php/__init__.py b/php/__init__.py index 6bb8aa7..f37d02e 100644 --- a/php/__init__.py +++ b/php/__init__.py @@ -1,3 +1,5 @@ +from __future__ import print_function + import sys @@ -12,12 +14,17 @@ def __getattr__(self, name): import tempfile def call_php_function(*args): - with tempfile.NamedTemporaryFile() as f: + with tempfile.NamedTemporaryFile(mode='w+t') as f: php_code = ( " test\n)\n') + if __name__ == '__main__': unittest.main() diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..501d031 --- /dev/null +++ b/tox.ini @@ -0,0 +1,5 @@ +[tox] +envlist = py26, py27, py33, py34, py35 + +[testenv] +commands = python tests.py