Skip to content

Commit

Permalink
setup.py: use portage EPREFIX if available
Browse files Browse the repository at this point in the history
Closes: https://bugs.gentoo.org/654128

Signed-off-by: Marty E. Plummer <[email protected]>
  • Loading branch information
hanetzer committed Apr 27, 2018
1 parent 8febe62 commit 7f51a0e
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@
_package_name = 'catalyst'
_maintainer_name, _maintainer_email = _parseaddr(__maintainer__)

# Load EPREFIX from Portage, fall back to the empty string if it fails
try:
from portage.const import EPREFIX
except ImportError:
EPREFIX=''

def _posix_path(path):
"""Convert a native path to a POSIX path
Expand Down Expand Up @@ -48,12 +53,18 @@ def _files(prefix, root):
yield (install_directory, file_source_paths)


_data_files = [('/etc/catalyst', ['etc/catalyst.conf','etc/catalystrc']),
('/usr/share/man/man1', ['files/catalyst.1']),
('/usr/share/man/man5', ['files/catalyst-config.5', 'files/catalyst-spec.5'])
_data_files = [
(_os.path.join(_os.sep, EPREFIX.lstrip(_os.sep), 'etc/catalyst'),
['etc/catalyst.conf','etc/catalystrc']),
(_os.path.join(_os.sep, EPREFIX.lstrip(_os.sep), 'usr/share/man/man1'),
['files/catalyst.1']),
(_os.path.join(_os.sep, EPREFIX.lstrip(_os.sep), 'usr/share/man/man5'),
['files/catalyst-config.5', 'files/catalyst-spec.5'])
]
_data_files.extend(_files('share/catalyst/livecd', 'livecd'))
_data_files.extend(_files('share/catalyst/targets', 'targets'))
_data_files.extend(_files(_os.path.join(_os.sep, EPREFIX.lstrip(_os.sep),
'usr/share/catalyst/livecd'), 'livecd'))
_data_files.extend(_files(_os.path.join(_os.sep, EPREFIX.lstrip(_os.sep),
'usr/share/catalyst/targets'), 'targets'))


class set_version(_Command):
Expand Down

0 comments on commit 7f51a0e

Please sign in to comment.