Allow multiple license symlinks

This commit is contained in:
Adam J. Stewart 2016-04-19 12:28:50 -05:00
parent 2a11cb8b76
commit 8bcb812529
2 changed files with 11 additions and 19 deletions

View file

@ -1029,13 +1029,6 @@ def global_license_file(self):
os.path.basename(self.license_files[0])) os.path.basename(self.license_files[0]))
def local_license_symlink(self):
"""Returns the path where a local license file is searched for."""
if not self.license_files:
return
return join_path(self.prefix, self.license_files[0])
def set_up_license(self): def set_up_license(self):
"""Prompt the user, letting them know that a license is required.""" """Prompt the user, letting them know that a license is required."""
@ -1086,9 +1079,9 @@ def write_license_file(self, license_path):
license.write("""\ license.write("""\
{0} A license is required to use {1}. {0} A license is required to use {1}.
{0} {0}
{0} The recommended solution is to store your license key in this file. {0} The recommended solution is to store your license key in this global
{0} By default, {1} searches the following file(s) for a license key {0} license file. After installation, the following symlink(s) will be
{0} (relative to the installation prefix): {0} added to point to this file (relative to the installation prefix):
{0} {0}
""".format(comment, self.name)) """.format(comment, self.name))
@ -1135,12 +1128,13 @@ def write_license_file(self, license_path):
def symlink_license(self): def symlink_license(self):
"""Create a local symlink that points to the global license file.""" """Create local symlinks that point to the global license file."""
target = self.global_license_file() target = self.global_license_file()
link_name = self.local_license_symlink() for filename in self.license_files:
if os.path.exists(target): link_name = join_path(self.prefix, filename)
os.symlink(target, link_name) if os.path.exists(target):
tty.msg("Added local symlink %s to global license file" % link_name) os.symlink(target, link_name)
tty.msg("Added local symlink %s to global license file" % link_name)
def do_install_dependencies(self, **kwargs): def do_install_dependencies(self, **kwargs):

View file

@ -11,9 +11,7 @@ class Nag(Package):
# Licensing # Licensing
license_required = True license_required = True
license_comment = '!' license_comment = '!'
license_files = ['lib/nag.key', license_files = ['lib/nag.key']
'lib/nag.licence',
'lib/nagware.licence']
license_vars = ['NAG_KUSARI_FILE'] license_vars = ['NAG_KUSARI_FILE']
license_url = 'http://www.nag.com/doc/inun/np61/lin-mac/klicence.txt' license_url = 'http://www.nag.com/doc/inun/np61/lin-mac/klicence.txt'