From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id A8EB4138247 for ; Fri, 22 Nov 2013 07:13:58 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 6B895E0AE0; Fri, 22 Nov 2013 07:13:43 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 7D471E0AE0 for ; Fri, 22 Nov 2013 07:13:32 +0000 (UTC) Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 67C0B33F326 for ; Fri, 22 Nov 2013 07:13:31 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id 66C44D0126 for ; Fri, 22 Nov 2013 07:13:28 +0000 (UTC) From: "Brian Dolbec" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Brian Dolbec" Message-ID: <1385100156.a49fe86db3a3a0511faa51e3e5f8a9af4cf41711.dol-sen@gentoo> Subject: [gentoo-commits] proj/catalyst:rewrite-on-master commit in: / X-VCS-Repository: proj/catalyst X-VCS-Files: setup.py X-VCS-Directories: / X-VCS-Committer: dol-sen X-VCS-Committer-Name: Brian Dolbec X-VCS-Revision: a49fe86db3a3a0511faa51e3e5f8a9af4cf41711 X-VCS-Branch: rewrite-on-master Date: Fri, 22 Nov 2013 07:13:28 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 026fec43-a0ab-4b02-b0c5-e7d14b76aa5b X-Archives-Hash: 99583a76e2e0082a1cb6cb83b49b33f2 commit: a49fe86db3a3a0511faa51e3e5f8a9af4cf41711 Author: Brian Dolbec gentoo org> AuthorDate: Fri Jun 7 14:42:27 2013 +0000 Commit: Brian Dolbec gmail com> CommitDate: Fri Nov 22 06:02:36 2013 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/catalyst.git;a=commit;h=a49fe86d Streamline data_files generation with additional keys * Move data_file generation out of setup(). * Return per-directory keys, since distutils only uses the directory key and value filename (not the value path) when installing data_files. * Use relative key paths for more flexible installation. * Raise NotImplementedError if os.path.sep is not '/', which allows for simpler path handling. --- setup.py | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/setup.py b/setup.py index f585b99..6bc4a06 100755 --- a/setup.py +++ b/setup.py @@ -22,7 +22,6 @@ from __future__ import print_function import codecs as _codecs from distutils.core import setup as _setup, Command as _Command -import itertools as _itertools import os as _os from catalyst import __version__ @@ -35,7 +34,10 @@ package_name = 'catalyst' tag = '{0}-{1}'.format(package_name, __version__) -def files(root): +if _os.path.sep != '/': + raise NotImplementedError('Non-POSIX paths are not supported') + +def files(root, target): """Iterate through all the file paths under `root` Distutils wants all paths to be written in the Unix convention @@ -44,11 +46,18 @@ def files(root): [1]: http://docs.python.org/2/distutils/setupscript.html#writing-the-setup-script """ for dirpath, dirnames, filenames in _os.walk(root): - for filename in filenames: - path = _os.path.join(dirpath, filename) - if _os.path.sep != '/': - path = path.replace(_os.path.sep, '/') - yield path + key = _os.path.join(target, dirpath) + filepaths = [_os.path.join(dirpath, filename) + for filename in filenames] + yield (key, filepaths) + + +_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.extend(files('livecd', 'lib/catalyst/')) +_data_files.extend(files('targets', 'lib/catalyst/')) class set_version(_Command): @@ -106,16 +115,7 @@ _setup( '{0}.base'.format(package_name), '{0}.targets'.format(package_name), ], - data_files=[ - ('/etc/catalyst', [ - 'etc/catalyst.conf', - 'etc/catalystrc', - ]), - ('lib/catalyst/', list(_itertools.chain( - files('livecd'), - files('targets'), - ))), - ], + data_files=_data_files, provides=[package_name], cmdclass={ 'set_version': set_version