summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndoni Morales Alastruey <ylatuya@gmail.com>2013-05-28 13:51:41 (GMT)
committerAndoni Morales Alastruey <ylatuya@gmail.com>2013-06-06 14:46:13 (GMT)
commita0ca699fc061f300de4fe7e0bff9ac8c734efcd0 (patch)
treefd15453434942e05f8ec690e48c2bb1653a51c94
parent9cc461b75a0bac51b856c6af5496683dd8450180 (diff)
downloadcerbero-a0ca699fc061f300de4fe7e0bff9ac8c734efcd0.tar.gz
cerbero-a0ca699fc061f300de4fe7e0bff9ac8c734efcd0.tar.xz
wix: move wix_prefix detection to utils
-rw-r--r--cerbero/config.py12
-rw-r--r--cerbero/packages/wix_packager.py6
-rw-r--r--cerbero/utils/__init__.py19
3 files changed, 23 insertions, 14 deletions
diff --git a/cerbero/config.py b/cerbero/config.py
index 9a55c7b..a55f56b 100644
--- a/cerbero/config.py
+++ b/cerbero/config.py
@@ -38,15 +38,6 @@ DEFAULT_PACKAGER = "Default <default@change.me>"
CERBERO_UNINSTALLED = 'CERBERO_UNINSTALLED'
CERBERO_PREFIX = 'CERBERO_PREFIX'
-DEFAULT_WIX_PREFIX = \
- 'C:/Program\ Files%s/Windows\ Installer\ XML\ v3.5/bin'
-def get_wix_prefix(arch):
- if arch == Architecture.X86:
- path = ''
- else:
- path = '\ \(x86\)'
- return DEFAULT_WIX_PREFIX % path
-
Platform = enums.Platform
Architecture = enums.Architecture
@@ -80,7 +71,7 @@ class Config (object):
'distro', 'target_distro', 'environ_dir', 'cache_file',
'toolchain_prefix', 'distro_version',
'target_distro_version', 'allow_system_libs',
- 'packages_dir', 'wix_prefix', 'py_prefix',
+ 'packages_dir', 'py_prefix',
'install_dir', 'allow_parallel_build', 'num_of_cpus',
'use_configure_cache', 'packages_prefix', 'packager',
'data_dir', 'min_osx_sdk_version', 'external_recipes',
@@ -277,7 +268,6 @@ class Config (object):
self.set_property('target_distro', distro)
self.set_property('distro_version', distro_version)
self.set_property('target_distro_version', distro_version)
- self.set_property('wix_prefix', get_wix_prefix(self.arch))
self.set_property('packages_prefix', None)
self.set_property('packager', DEFAULT_PACKAGER)
self.set_property('py_prefix', 'lib/python%s.%s' %
diff --git a/cerbero/packages/wix_packager.py b/cerbero/packages/wix_packager.py
index a43357f..e8acc49 100644
--- a/cerbero/packages/wix_packager.py
+++ b/cerbero/packages/wix_packager.py
@@ -23,7 +23,7 @@ from cerbero.errors import EmptyPackageError
from cerbero.packages import PackagerBase, PackageType
from cerbero.packages.package import Package, App
from cerbero.utils import messages as m
-from cerbero.utils import shell, to_winepath
+from cerbero.utils import shell, to_winepath, get_wix_prefix
from cerbero.packages.wix import MergeModule, MSI, WixConfig
from cerbero.config import Platform
@@ -33,7 +33,7 @@ class MergeModulePackager(PackagerBase):
def __init__(self, config, package, store):
PackagerBase.__init__(self, config, package, store)
self._with_wine = config.platform != Platform.WINDOWS
- self.wix_prefix = config.wix_prefix
+ self.wix_prefix = get_wix_prefix()
def pack(self, output_dir, devel=False, force=False, keep_temp=False):
PackagerBase.pack(self, output_dir, devel, force, keep_temp)
@@ -94,7 +94,7 @@ class MSIPackager(PackagerBase):
def __init__(self, config, package, store):
PackagerBase.__init__(self, config, package, store)
self._with_wine = config.platform != Platform.WINDOWS
- self.wix_prefix = config.wix_prefix
+ self.wix_prefix = get_wix_prefix()
def pack(self, output_dir, devel=False, force=False, keep_temp=False):
self.output_dir = os.path.realpath(output_dir)
diff --git a/cerbero/utils/__init__.py b/cerbero/utils/__init__.py
index 030e946..81470e1 100644
--- a/cerbero/utils/__init__.py
+++ b/cerbero/utils/__init__.py
@@ -250,3 +250,22 @@ def parse_file(filename, dict):
import traceback
traceback.print_exc()
raise ex
+
+
+def escape_path(path):
+ path = path.replace('\\', '/')
+ path = path.replace('(', '\\\(').replace(')', '\\\)')
+ path = path.replace(' ', '\\\\ ')
+ return path
+
+
+def get_wix_prefix():
+ if 'WIX' in os.environ:
+ wix_prefix = os.path.join(os.environ['WIX'], 'bin')
+ else:
+ wix_prefix = 'C:/Program Files%s/Windows Installer XML v3.5/bin'
+ if not os.path.exists(wix_prefix):
+ wix_prefix = wix_prefix % ' (x86)'
+ if not os.path.exists(wix_prefix):
+ raise FatalError("The required packaging tool 'WiX' was not found")
+ return escape_path(to_unixpath(wix_prefix))