Skip to content
Browse files

Control narwhal-jsc installation using environment

  • Loading branch information...
1 parent 7f7bae7 commit 416e6ff231db4a36dbdc2b1055c3ec32dce6f7d2 @jukart jukart committed Jan 23, 2011
Showing with 59 additions and 43 deletions.
  1. +6 −0 CHANGES.txt
  2. +5 −1 README.rst
  3. +1 −1 setup.py
  4. +47 −41 src/lovely/recipe/cappuccino/install.py
View
6 CHANGES.txt
@@ -2,6 +2,12 @@
CHANGES
=======
+2011/01/23 0.0.7
+----------------
+
+ - narwhal-jsc can also be activated from environment variable
+ "buildoutnarwhaljsc"
+
2011/01/14 0.0.6
----------------
View
6 README.rst
@@ -44,7 +44,11 @@ if the path <path>/narwhal doesn't exist::
- run "tusk install cappuccino"
- run "tusk install <required>" for every <narwahl-reqired> package
-If we are installing on a MAC (uname == 'Darwin') narwhal-jsc is compiled.
+By default narwhal-jsc is not installed. It can be controlled by the
+"narwhal-jsc" buildout option or by setting the environment variable
+"buildoutnarwhaljsc".
+Independent of this narwhal-jsc is only installen on MAC-OS-X (uname ==
+'Darwin').
At this point of the installation we have narwhal installed at <path>/narwahl
with the latest released cappuccino version.
View
2 setup.py
@@ -19,7 +19,7 @@ def read(*rnames):
+ '\n\n' +
read('CHANGES.txt')
),
- version='0.0.6',
+ version='0.0.7',
author = "Lovely Systems",
author_email = "office@lovelysystems.com",
license = "ZPL 2.1",
View
88 src/lovely/recipe/cappuccino/install.py
@@ -27,7 +27,11 @@ def __init__(self, buildout, name, options):
self.narwhalPath = os.path.join(self.path, 'narwhal')
self.narwhalUser = options.get('narwhal-user', NARWHAL_USER)
self.narwhalRef = options.get('narwhal-ref', NARWHAL_REF)
- self.narwhal_jsc = bool(options.get('narwhal-jsc', False))
+ self.narwhal_jsc = options.get('narwhal-jsc', None)
+ if self.narwhal_jsc is None:
+ # this option can also be set as an environment variable
+ self.narwhal_jsc = os.environ.get("buildoutnarwhaljsc")
+ self.narwhal_jsc = bool(self.narwhal_jsc)
nr = options.get('narwhal-required', ())
if nr:
nr = tuple(nr.strip().split())
@@ -40,55 +44,57 @@ def install(self):
os.environ['PATH'] = os.path.join(self.narwhalPath, 'bin') \
+ ':' \
+ os.environ['PATH']
- zip_ball="http://github.com/%s/narwhal/zipball/%s"% (
- self.narwhalUser, self.narwhalRef)
- narwhalZip, isTemp = zc.buildout.download.Download(
- self.buildout.get('buildout'),
- hash_name = True,
- logger = logger,
- )(zip_ball)
if not os.path.exists(self.narwhalPath):
+ zip_ball="http://github.com/%s/narwhal/zipball/%s"% (
+ self.narwhalUser, self.narwhalRef)
+ narwhalZip, isTemp = zc.buildout.download.Download(
+ self.buildout.get('buildout'),
+ hash_name = True,
+ logger = logger,
+ )(zip_ball)
cmd = subprocess.Popen(('unzip', narwhalZip, '-d', '/tmp'))
stdout, stderr = cmd.communicate()
files = [f for f in os.listdir('/tmp')
if f.startswith(self.narwhalUser)]
shutil.move(os.path.join('/tmp', files[0]), self.narwhalPath)
- tusk = os.path.join(self.narwhalPath, 'bin', 'tusk')
- cmd = subprocess.Popen((tusk, 'install') + REQUIRED_PACKAGES)
+ # We have a bare narwhal installation.
+ tusk = os.path.join(self.narwhalPath, 'bin', 'tusk')
+ cmd = subprocess.Popen((tusk, 'install') + REQUIRED_PACKAGES)
+ stdout, stderr = cmd.communicate()
+ if self.narwhal_jsc and os.uname()[0] == 'Darwin':
+ cmd = subprocess.Popen((tusk, 'install', 'narwhal-jsc'))
stdout, stderr = cmd.communicate()
- if self.narwhal_jsc and os.uname()[0] == 'Darwin':
- cmd = subprocess.Popen((tusk, 'install', 'narwhal-jsc'))
- stdout, stderr = cmd.communicate()
- # build jsc for webkit
- os.environ['NARWHAL_ENGINE'] = 'jsc'
- wd = os.getcwd()
- os.chdir(os.path.join(self.narwhalPath, 'packages', 'narwhal-jsc'))
- cmd = subprocess.Popen(('make', 'webkit',))
- stdout, stderr = cmd.communicate()
- os.chdir(wd)
+ # build jsc for webkit
+ os.environ['NARWHAL_ENGINE'] = 'jsc'
+ wd = os.getcwd()
+ os.chdir(os.path.join(self.narwhalPath, 'packages', 'narwhal-jsc'))
+ cmd = subprocess.Popen(('make', 'webkit',))
+ stdout, stderr = cmd.communicate()
+ os.chdir(wd)
- # at this point we have a narwhal installation
- if self.cappuccinoDevelop is not None:
- # install cappuccino from a git clone
- os.environ['CAPP_BUILD'] = os.path.join(
- self.cappuccinoDevelop, 'Build')
- jake = os.path.join(self.narwhalPath, 'bin', 'jake')
- wd = os.getcwd()
- os.chdir(self.cappuccinoDevelop)
- cmd = subprocess.Popen((jake, 'install',))
- stdout, stderr = cmd.communicate()
- os.chdir(wd)
- else:
- # install standard package
- cmd = subprocess.Popen((tusk, 'install', 'cappuccino'))
- stdout, stderr = cmd.communicate()
- # Install the required packages from the buildout configuration.
- # We use a separate call to tusk for each package because of
- # problems otherwise.
- for package in self.narwhalRequired:
- cmd = subprocess.Popen((tusk, 'install', package))
- stdout, stderr = cmd.communicate()
+ # At this point we have a narwhal installation with all required
+ # packages to be able to install cappuccino.
+ if self.cappuccinoDevelop is not None:
+ # install cappuccino from a git clone
+ os.environ['CAPP_BUILD'] = os.path.join(
+ self.cappuccinoDevelop, 'Build')
+ jake = os.path.join(self.narwhalPath, 'bin', 'jake')
+ wd = os.getcwd()
+ os.chdir(self.cappuccinoDevelop)
+ cmd = subprocess.Popen((jake, 'install',))
+ stdout, stderr = cmd.communicate()
+ os.chdir(wd)
+ else:
+ # install standard package
+ cmd = subprocess.Popen((tusk, 'install', 'cappuccino'))
+ stdout, stderr = cmd.communicate()
+ # Install the required packages from the buildout configuration.
+ # We use a separate call to tusk for each package because of
+ # problems otherwise.
+ for package in self.narwhalRequired:
+ cmd = subprocess.Popen((tusk, 'install', package))
+ stdout, stderr = cmd.communicate()
return (self.narwhalPath,)
def update(self):

0 comments on commit 416e6ff

Please sign in to comment.
Something went wrong with that request. Please try again.