Skip to content

Commit

Permalink
Updates to setup
Browse files Browse the repository at this point in the history
- Use find_packages from setuptools/distutils
- Add libqtile/resources to MANIFEST.in so that, e.g., battery icons are installed
  • Loading branch information
dmpayton committed Jul 10, 2012
1 parent e903bc4 commit 76e2810
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 94 deletions.
4 changes: 3 additions & 1 deletion MANIFEST.in
@@ -1,7 +1,9 @@
include LICENSE include LICENSE
include README.rst
recursive-include examples * recursive-include examples *
recursive-include contrib * recursive-include contrib *
recursive-include docs *.html *.js *.css *.png
recursive-include libqtile/resources *
recursive-include scripts * recursive-include scripts *
recursive-include test * recursive-include test *
recursive-include doc *.html *.js *.css *.png
recursive-exclude test *.swo *.swp *.pyc recursive-exclude test *.swo *.swp *.pyc
119 changes: 26 additions & 93 deletions setup.py
@@ -1,4 +1,9 @@
from distutils.core import setup #!/usr/bin/env python

try:
from setuptools import setup, find_packages
except ImportError:
from distutils.core import setup, find_packages


long_description = """ long_description = """
A pure-Python tiling window manager. A pure-Python tiling window manager.
Expand All @@ -19,97 +24,25 @@
Qtile depends on the Python X Library (http://python-xlib.sourceforge.net/). Qtile depends on the Python X Library (http://python-xlib.sourceforge.net/).
""" """


"""
The content below is included from the distextend project.
The code is in the public domain, and may be used for any purpose
whatsoever.
"""
import fnmatch
import os.path


def _fnmatch(name, patternList):
for i in patternList:
if fnmatch.fnmatch(name, i):
return True
return False


def _splitAll(path):
parts = []
h = path
while 1:
if not h:
break
h, t = os.path.split(h)
parts.append(t)
parts.reverse()
return parts


def findPackages(path, dataExclude=[]):
"""
Recursively find all packages and data directories rooted at path. Note
that only data _directories_ and their contents are returned -
non-Python files at module scope are not, and should be manually
included.
dataExclude is a list of fnmatch-compatible expressions for files and
directories that should not be included in pakcage_data.
Returns a (packages, package_data) tuple, ready to be passed to the
corresponding distutils.core.setup arguments.
"""
packages = []
datadirs = []
for root, dirs, files in os.walk(path, topdown=True):
if "__init__.py" in files:
p = _splitAll(root)
packages.append(".".join(p))
else:
dirs[:] = []
if packages:
datadirs.append(root)

package_data = {}
for i in datadirs:
if not _fnmatch(i, dataExclude):
parts = _splitAll(i)
module = ".".join(parts[:-1])
acc = package_data.get(module, [])
for root, dirs, files in os.walk(i, topdown=True):
sub = os.path.join(*_splitAll(root)[1:])
if not _fnmatch(sub, dataExclude):
for fname in files:
path = os.path.join(sub, fname)
if not _fnmatch(path, dataExclude):
acc.append(path)
else:
dirs[:] = []
package_data[module] = acc
return packages, package_data

packages, package_data = findPackages("libqtile")


setup( setup(
name="qtile", name="qtile",
version="0.5", version="0.5",
description="A pure-Python tiling window manager.", description="A pure-Python tiling window manager.",
author="Aldo Cortesi", long_description=long_description,
author_email="aldo@nullcube.com", classifiers=[
license="MIT", "Intended Audience :: End Users/Desktop",
url="http://www.qtile.org", "License :: OSI Approved :: MIT License",
packages=packages, "Development Status :: 3 - Alpha",
package_data=package_data, "Programming Language :: Python",
scripts=["qtile-session", "qtile", "qsh"], "Operating System :: Unix",
classifiers=[ "Topic :: Desktop Environment :: Window Managers",
"Intended Audience :: End Users/Desktop", ],
"License :: OSI Approved :: MIT License", keywords="qtile tiling window manager",
"Development Status :: 3 - Alpha", author="Aldo Cortesi",
"Programming Language :: Python", author_email="aldo@nullcube.com",
"Operating System :: Unix", url="http://qtile.org",
"Topic :: Desktop Environment :: Window Managers", license="MIT",
] include_package_data=True,
packages=find_packages(),
scripts=["qtile-session", "qtile", "qsh"],
) )

0 comments on commit 76e2810

Please sign in to comment.