Properly work with any directory

Add imageformats folder and dependencies QtXml and QtSvg, to fix problem where files of type jpeg, gif, svg, .., were not supported
Copy directories examples, plugins, over on build.
Copy files README.md, LICENSE, over on build.
This commit is contained in:
IceArmy
2011-06-10 21:14:03 -07:00
parent a5885abcbf
commit e32ea74eaf
+25 -3
View File
@@ -21,7 +21,10 @@
import os
import sys
# hack to import parent module(s)
sys.path = sys.path + [os.path.dirname(os.path.dirname(os.path.abspath(__file__)))]
parent_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path = sys.path + [parent_dir]
from distutils.sysconfig import get_python_lib
from utils import version
@@ -41,9 +44,27 @@ if sys.platform.startswith('win'):
sleep(2)
# modules to include
includes = [
# to make sure images are supported; jpeg, gif, svg, etc.
'PyQt4.QtSvg',
'PyQt4.QtXml'
]
# files/directories to include
include_files = [
# to make sure images are supported; jpeg, gif, svg, etc.
(os.path.join(get_python_lib(), 'PyQt4/plugins/imageformats'), 'imageformats'),
(os.path.join(parent_dir, 'plugins'), 'plugins'),
(os.path.join(parent_dir, '../examples' if os.path.exists('../examples') else '../../examples'), 'examples'),
(os.path.join(parent_dir, '../LICENSE'), 'LICENSE.txt'),
(os.path.join(parent_dir, '../README.md'), 'README.txt')
]
exe = Executable(
script = '../pyphantomjs.py',
icon = '../resources/pyphantomjs-icon.ico'
script = os.path.join(parent_dir, 'pyphantomjs.py'),
icon = os.path.join(parent_dir, 'resources/pyphantomjs-icon.ico')
)
@@ -51,5 +72,6 @@ setup(
name = 'PyPhantomJS',
version = version,
description = 'Minimalistic, headless, WebKit-based, JavaScript-driven tool',
options = {'build_exe': {'includes': includes, 'include_files': include_files}},
executables = [exe]
)