From: Brian Dolbec Date: Tue, 11 Jun 2013 02:15:31 +0000 (-0700) Subject: Remove ensure_slash(), optimize the code X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=62d4e916daebbef19be3353989cc089075ece413;p=catalyst.git Remove ensure_slash(), optimize the code Just print an ERROR message if it os.path.separator is not '/'. Remove unused import. --- diff --git a/setup.py b/setup.py index f3aa7b43..734c0fe8 100755 --- a/setup.py +++ b/setup.py @@ -22,8 +22,8 @@ from __future__ import print_function import codecs as _codecs from distutils.core import setup as _setup, Command -import itertools as _itertools import os as _os +import sys from catalyst import __version__ from catalyst.version import set_release_version, get_version @@ -34,6 +34,11 @@ package_name = 'catalyst' tag = '{0}-{1}'.format(package_name, __version__) +if _os.path.sep != '/': + print("ERROR: This system does not appear to be a 'POSIX' system.") + print("Catalyst is meant to install and run on a 'GENTOO' system only.") + sys.exit(2) + def files(root, target): """Iterate through all the file paths under `root` @@ -42,21 +47,13 @@ def files(root, target): [1]: http://docs.python.org/2/distutils/setupscript.html#writing-the-setup-script """ - def ensure_slash(path): - if _os.path.sep != '/': - path.replace(_os.path.sep, '/') - return path - filedict = {} for dirpath, dirnames, filenames in _os.walk(root): key = _os.path.join(target, dirpath) filepaths = [] for _file in filenames: - _filepath = ensure_slash(_os.path.join(dirpath, _file)) + _filepath = _os.path.join(dirpath, _file) filepaths.append(_filepath) - filedict[key] = filepaths - for key in sorted(filedict): - if len(filedict[key]): - yield (key, filedict[key]) + yield (key, filepaths) _data_files = [('/etc/catalyst', ['etc/catalyst.conf','etc/catalystrc']),