Skip to content

Commit

Permalink
This new setup.py allows to use the standard distutils infrastructure…
Browse files Browse the repository at this point in the history
… building pycim.

Used in the normal way beaves exactly as the previous setup.py (making use of setutools).

When called as in:

$> USE_DISTUTILS=1 INCLUDE_PACKAGE_DATA=1 python setup.py build

This will use the distutils infrastructure and it will add the test dataset to the final build.

Patch provided by: Antonio Cavallo <a.cavallo@cavallinux.eu>
  • Loading branch information
rwl committed Jul 24, 2012
1 parent 092f100 commit 89a0a5d
Showing 1 changed file with 27 additions and 5 deletions.
32 changes: 27 additions & 5 deletions setup.py
@@ -1,10 +1,35 @@
import os
from setuptools import setup, find_packages

kwds = {}

if int(os.getenv('USE_DISTUTILS', 0)) != 0:
from distutils.core import setup
def find_packages():
packages = []
basedir = os.getcwd()
for root, dirnames, filenames in os.walk(basedir):
for dirname in dirnames:
initfile = os.path.join(root, dirname, "__init__.py")
if os.path.exists(initfile):
# python 2.4+
packages.append(os.path.relpath(initfile, basedir))
packages = [ os.path.dirname(p).replace(os.path.sep, ".") for p in packages ]
return sorted(packages)

# To add the test data to the final package
if int(os.getenv('INCLUDE_PACKAGE_DATA', 0)) != 0:
kwds['package_data'] = { 'PyCIM.Test' : [ 'Data/*'], }
else:
from setuptools import setup, find_packages
kwds['include_package_data'] = False
kwds['test_suite'] = "PyCIM.Test"
kwds['zip_safe'] = True


# Read the long description from the README.
thisdir = os.path.abspath(os.path.dirname(__file__))
f = open(os.path.join(thisdir, "README"))
kwds = {"long_description": f.read()}
kwds["long_description"] = f.read()
f.close()

setup(name="PyCIM",
Expand All @@ -14,10 +39,7 @@
description="Python implementation of the Common Information Model.",
license="MIT",
url="http://www.pycim.org/",
include_package_data=False,
packages=find_packages(),
test_suite="PyCIM.Test",
zip_safe=True,
**kwds)

# python setup.py sdist bdist_egg bdist_wininst bdist_msi upload

0 comments on commit 89a0a5d

Please sign in to comment.