-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #390 from itamarst/386.pyinstaller
Support for PyInstaller
- Loading branch information
Showing
6 changed files
with
64 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
"""Test for pyinstaller compatibility.""" | ||
|
||
from __future__ import absolute_import | ||
|
||
from unittest import TestCase, SkipTest | ||
from tempfile import mkdtemp, NamedTemporaryFile | ||
from subprocess import check_call, CalledProcessError | ||
import os | ||
|
||
from six import PY2 | ||
if PY2: | ||
FileNotFoundError = OSError | ||
|
||
|
||
class PyInstallerTests(TestCase): | ||
"""Make sure PyInstaller doesn't break Eliot.""" | ||
|
||
def setUp(self): | ||
try: | ||
check_call(["pyinstaller", "--help"]) | ||
except (CalledProcessError, FileNotFoundError): | ||
raise SkipTest("Can't find pyinstaller.") | ||
|
||
def test_importable(self): | ||
"""The Eliot package can be imported inside a PyInstaller packaged binary.""" | ||
output_dir = mkdtemp() | ||
with NamedTemporaryFile(mode="w") as f: | ||
f.write("import eliot; import eliot.prettyprint\n") | ||
f.flush() | ||
check_call( | ||
["pyinstaller", "--distpath", output_dir, | ||
"-F", "-n", "importeliot", f.name] | ||
) | ||
check_call([os.path.join(output_dir, "importeliot")]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters