changes to appease flake8 (mostly) for lua package
This commit is contained in:
parent
12e36ee0e7
commit
21161a60ff
@ -25,6 +25,7 @@
|
|||||||
from spack import *
|
from spack import *
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
|
||||||
class Lua(Package):
|
class Lua(Package):
|
||||||
""" The Lua programming language interpreter and library """
|
""" The Lua programming language interpreter and library """
|
||||||
homepage = "http://www.lua.org"
|
homepage = "http://www.lua.org"
|
||||||
@ -47,7 +48,8 @@ class Lua(Package):
|
|||||||
depends_on('ncurses')
|
depends_on('ncurses')
|
||||||
depends_on('readline')
|
depends_on('readline')
|
||||||
|
|
||||||
resource(name="luarocks",
|
resource(
|
||||||
|
name="luarocks",
|
||||||
url="https://keplerproject.github.io/luarocks/releases/luarocks-2.3.0.tar.gz",
|
url="https://keplerproject.github.io/luarocks/releases/luarocks-2.3.0.tar.gz",
|
||||||
md5="a38126684cf42b7d0e7a3c7cf485defb",
|
md5="a38126684cf42b7d0e7a3c7cf485defb",
|
||||||
destination="luarocks",
|
destination="luarocks",
|
||||||
@ -59,15 +61,13 @@ def install(self, spec, prefix):
|
|||||||
else:
|
else:
|
||||||
target = 'linux'
|
target = 'linux'
|
||||||
make('INSTALL_TOP=%s' % prefix,
|
make('INSTALL_TOP=%s' % prefix,
|
||||||
'MYLDFLAGS=-L%s -lncurses' % spec['ncurses'].prefix.lib,
|
'MYLDFLAGS=-L%s -lncurses' % spec['ncurses'].prefix.lib, target)
|
||||||
target)
|
|
||||||
make('INSTALL_TOP=%s' % prefix,
|
make('INSTALL_TOP=%s' % prefix,
|
||||||
'MYLDFLAGS=-L%s -lncurses' % spec['ncurses'].prefix.lib,
|
'MYLDFLAGS=-L%s -lncurses' % spec['ncurses'].prefix.lib,
|
||||||
'install')
|
'install')
|
||||||
|
|
||||||
with working_dir(os.path.join('luarocks','luarocks')):
|
with working_dir(os.path.join('luarocks', 'luarocks')):
|
||||||
configure('--prefix=' + prefix,
|
configure('--prefix=' + prefix, '--with-lua=' + prefix)
|
||||||
'--with-lua=' + prefix)
|
|
||||||
make('build')
|
make('build')
|
||||||
make('install')
|
make('install')
|
||||||
|
|
||||||
@ -77,8 +77,7 @@ def append_paths(self, paths, cpaths, path):
|
|||||||
cpaths.append(os.path.join(path, '?.so'))
|
cpaths.append(os.path.join(path, '?.so'))
|
||||||
|
|
||||||
def setup_dependent_environment(self, spack_env, run_env, extension_spec):
|
def setup_dependent_environment(self, spack_env, run_env, extension_spec):
|
||||||
lua_paths = [
|
lua_paths = []
|
||||||
]
|
|
||||||
for d in extension_spec.traverse():
|
for d in extension_spec.traverse():
|
||||||
if d.package.extends(self.spec):
|
if d.package.extends(self.spec):
|
||||||
lua_paths.append(os.path.join(d.prefix, self.lua_lib_dir))
|
lua_paths.append(os.path.join(d.prefix, self.lua_lib_dir))
|
||||||
@ -91,31 +90,41 @@ def setup_dependent_environment(self, spack_env, run_env, extension_spec):
|
|||||||
self.append_paths(lua_patterns, lua_cpatterns, p)
|
self.append_paths(lua_patterns, lua_cpatterns, p)
|
||||||
|
|
||||||
# Always add this package's paths
|
# Always add this package's paths
|
||||||
for p in ( os.path.join(self.spec.prefix, self.lua_lib_dir), os.path.join(self.spec.prefix, self.lua_share_dir)):
|
for p in (os.path.join(self.spec.prefix, self.lua_lib_dir),
|
||||||
|
os.path.join(self.spec.prefix, self.lua_share_dir)):
|
||||||
self.append_paths(lua_patterns, lua_cpatterns, p)
|
self.append_paths(lua_patterns, lua_cpatterns, p)
|
||||||
|
|
||||||
|
|
||||||
spack_env.set('LUA_PATH', ';'.join(lua_patterns), separator=';')
|
spack_env.set('LUA_PATH', ';'.join(lua_patterns), separator=';')
|
||||||
spack_env.set('LUA_CPATH', ';'.join(lua_cpatterns), separator=';')
|
spack_env.set('LUA_CPATH', ';'.join(lua_cpatterns), separator=';')
|
||||||
|
|
||||||
# For run time environment set only the path for extension_spec and prepend it to LUAPATH
|
# For run time environment set only the path for extension_spec and prepend it to LUAPATH
|
||||||
if extension_spec.package.extends(self.spec):
|
if extension_spec.package.extends(self.spec):
|
||||||
run_env.prepend_path('LUA_PATH', ';'.join(lua_patterns), separator=';')
|
run_env.prepend_path('LUA_PATH', ';'.join(lua_patterns),
|
||||||
run_env.prepend_path('LUA_CPATH', ';'.join(lua_cpatterns), separator=';')
|
separator=';')
|
||||||
# run_env.prepend_path('LUA_PATH', os.path.join(extension_spec.prefix, self.lua_lib_dir, '?.lua'), separator=';')
|
run_env.prepend_path('LUA_CPATH', ';'.join(lua_cpatterns),
|
||||||
# run_env.prepend_path('LUA_PATH', os.path.join(extension_spec.prefix, self.lua_lib_dir, '?', 'init.lua'), separator=';')
|
separator=';')
|
||||||
# run_env.prepend_path('LUA_CPATH', os.path.join(extension_spec.prefix, self.lua_lib_dir, '?.so'), separator=';')
|
|
||||||
|
|
||||||
def setup_environment(self, spack_env, run_env):
|
def setup_environment(self, spack_env, run_env):
|
||||||
run_env.prepend_path('LUA_PATH', os.path.join(self.spec.prefix, self.lua_share_dir, '?.lua'), separator=';')
|
run_env.prepend_path('LUA_PATH', os.path.join(
|
||||||
run_env.prepend_path('LUA_PATH', os.path.join(self.spec.prefix, self.lua_share_dir, '?', 'init.lua'), separator=';')
|
self.spec.prefix, self.lua_share_dir, '?.lua'),
|
||||||
run_env.prepend_path('LUA_PATH', os.path.join(self.spec.prefix, self.lua_lib_dir, '?.lua'), separator=';')
|
separator=';')
|
||||||
run_env.prepend_path('LUA_PATH', os.path.join(self.spec.prefix, self.lua_lib_dir, '?', 'init.lua'), separator=';')
|
run_env.prepend_path('LUA_PATH', os.path.join(
|
||||||
run_env.prepend_path('LUA_CPATH', os.path.join(self.spec.prefix, self.lua_lib_dir, '?.so'), separator=';')
|
self.spec.prefix, self.lua_share_dir, '?', 'init.lua'),
|
||||||
|
separator=';')
|
||||||
|
run_env.prepend_path('LUA_PATH', os.path.join(
|
||||||
|
self.spec.prefix, self.lua_lib_dir, '?.lua'),
|
||||||
|
separator=';')
|
||||||
|
run_env.prepend_path('LUA_PATH', os.path.join(
|
||||||
|
self.spec.prefix, self.lua_lib_dir, '?', 'init.lua'),
|
||||||
|
separator=';')
|
||||||
|
run_env.prepend_path('LUA_CPATH', os.path.join(
|
||||||
|
self.spec.prefix, self.lua_lib_dir, '?.so'),
|
||||||
|
separator=';')
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def lua_lib_dir(self):
|
def lua_lib_dir(self):
|
||||||
return os.path.join('lib', 'lua', '%d.%d' % self.version[:2])
|
return os.path.join('lib', 'lua', '%d.%d' % self.version[:2])
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def lua_share_dir(self):
|
def lua_share_dir(self):
|
||||||
return os.path.join('share', 'lua', '%d.%d' % self.version[:2])
|
return os.path.join('share', 'lua', '%d.%d' % self.version[:2])
|
||||||
@ -130,5 +139,5 @@ def setup_dependent_package(self, module, ext_spec):
|
|||||||
"""
|
"""
|
||||||
# Lua extension builds can have lua and luarocks executable functions
|
# Lua extension builds can have lua and luarocks executable functions
|
||||||
module.lua = Executable(join_path(self.spec.prefix.bin, 'lua'))
|
module.lua = Executable(join_path(self.spec.prefix.bin, 'lua'))
|
||||||
module.luarocks = Executable(join_path(self.spec.prefix.bin, 'luarocks'))
|
module.luarocks = Executable(join_path(self.spec.prefix.bin,
|
||||||
|
'luarocks'))
|
||||||
|
Loading…
Reference in New Issue
Block a user