Browse files

tox+setup

  • Loading branch information...
1 parent a6910bf commit 338476fd658f46081afb366e52034fc13c34cec3 ponty committed Mar 10, 2012
Showing with 188 additions and 113 deletions.
  1. +2 −1 .gitignore
  2. +0 −1 MANIFEST.in
  3. +68 −103 pavement.py
  4. BIN paver-minilib.zip
  5. +0 −2 requirements.txt
  6. +53 −6 setup.py
  7. +65 −0 tox.ini
View
3 .gitignore
@@ -17,12 +17,13 @@ pip-log.txt
*/build/*
*/_build/*
*/_build/latex/*
-#.*
+
*.class
*.png
.version
nosetests.xml
+.*
!.gitignore
/distribute_setup.py
View
1 MANIFEST.in
@@ -1,7 +1,6 @@
grant docs
include LICENSE*
include pavement.py
-include paver-minilib.zip
include TODO*
include requirements.txt
include CHANGES*
View
171 pavement.py
@@ -2,71 +2,20 @@
from paver.setuputils import setup
from setuptools import find_packages
-try:
- # Optional tasks, only needed for development
- import paver.doctools
- import paver.virtual
- import paver.misctasks
- from paved import *
- from paved.dist import *
- from paved.util import *
- from paved.docs import *
- from paved.pycheck import *
- from paved.pkg import *
- from sphinxcontrib import paverutils
- ALL_TASKS_LOADED = True
-except ImportError, e:
- info("some tasks could not not be imported.")
- debug(str(e))
- ALL_TASKS_LOADED = False
+import paver.doctools
+import paver.virtual
+import paver.misctasks
+from paved import *
+from paved.dist import *
+from paved.util import *
+from paved.docs import *
+from paved.pycheck import *
+from paved.pkg import *
+from sphinxcontrib import paverutils
-def read_project_version(py=None, where='.', exclude=['bootstrap', 'pavement', 'doc', 'docs', 'test', 'tests', ]):
- if not py:
- py = path(where) / find_packages(where=where, exclude=exclude)[0]
- py = path(py)
- if py.isdir():
- py = py / '__init__.py'
- __version__ = None
- for line in py.lines():
- if '__version__' in line:
- exec line
- break
- return __version__
-
-NAME = 'PyVirtualDisplay'
-URL = 'https://github.com/ponty/PyVirtualDisplay'
-DESCRIPTION = 'python wrapper for Xvfb, Xephyr and Xvnc'
-VERSION = read_project_version()
-
-
-classifiers = [
- # Get more strings from http://www.python.org/pypi?%3Aaction=list_classifiers
- "License :: OSI Approved :: BSD License",
- "Natural Language :: English",
- "Operating System :: OS Independent",
- "Programming Language :: Python",
- ]
-
-install_requires = open("requirements.txt").read().split('\n')
-
-# compatible with distutils of python 2.3+ or later
-setup(
- name=NAME,
- version=VERSION,
- description=DESCRIPTION,
- long_description=open('README.rst', 'r').read(),
- classifiers=classifiers,
- keywords='Xvfb Xephyr X wrapper',
- author='ponty',
- #author_email='',
- url=URL,
- license='BSD',
- packages=find_packages(exclude=['bootstrap', 'pavement', ]),
- include_package_data=True,
- test_suite='nose.collector',
- zip_safe=False,
- install_requires=install_requires,
- )
+# get info from setup.py
+setup_py=''.join([x for x in path('setup.py').lines() if 'setuptools' not in x])
+exec(setup_py)
options(
@@ -80,46 +29,62 @@ def read_project_version(py=None, where='.', exclude=['bootstrap', 'pavement', '
),
)
-if ALL_TASKS_LOADED:
-
- options.paved.clean.patterns += ['*.pickle',
- '*.doctree',
- '*.gz' ,
- 'nosetests.xml',
- 'sloccount.sc',
- '*.pdf', '*.tex',
- '*.png',
- ]
-
- options.paved.dist.manifest.include.remove('distribute_setup.py')
- options.paved.dist.manifest.include.add('requirements.txt')
-
-
- @task
- @needs(
- 'clean',
- 'sloccount',
- 'html',
- 'pdf',
- 'sdist',
- 'nose',
- )
- def alltest():
- 'all tasks to check'
- pass
-
- @task
- @needs('sphinxcontrib.paverutils.html')
- def html():
- pass
+options.paved.clean.rmdirs += ['.tox',
+ 'dist',
+ 'build' ,
+ ]
+options.paved.clean.patterns += ['*.pickle',
+ '*.doctree',
+ '*.gz' ,
+ 'nosetests.xml',
+ 'sloccount.sc',
+ '*.pdf', '*.tex',
+ '*.png',
+ '*.zip',
+ 'distribute_setup.py',
+ ]
+
+options.paved.dist.manifest.include.remove('distribute_setup.py')
+options.paved.dist.manifest.include.remove('paver-minilib.zip')
+options.paved.dist.manifest.include.add('requirements.txt')
- @task
- @needs('sphinxcontrib.paverutils.pdf')
- def pdf():
- fpdf = list(path('docs/_build/latex').walkfiles('*.pdf'))[0]
- d = path('docs/_build/html')
- d.makedirs()
- fpdf.copy(d)
+@task
+@needs(
+# 'clean',
+ 'sloccount',
+ 'html',
+ 'pdf',
+ 'sdist',
+ 'nose', 'tox',
+ )
+def alltest():
+ 'all tasks to check'
+ pass
+@task
+@needs('sphinxcontrib.paverutils.html')
+def html():
+ pass
+
+@task
+@needs('sphinxcontrib.paverutils.pdf')
+def pdf():
+ fpdf = list(path('docs/_build/latex').walkfiles('*.pdf'))[0]
+ d = path('docs/_build/html')
+ d.makedirs()
+ fpdf.copy(d)
+
+@task
+def tox():
+ '''Run tox.'''
+ sh('tox')
+
+
+@task
+@needs('manifest', 'setuptools.command.sdist')
+def sdist():
+ """Overrides sdist to make sure that our MANIFEST.in is generated.
+ """
+ pass
View
BIN paver-minilib.zip
Binary file not shown.
View
2 requirements.txt
@@ -1,5 +1,3 @@
-setuptools
-path.py
EasyProcess
entrypoint2
View
59 setup.py
@@ -1,7 +1,54 @@
-import os
-if os.path.exists("paver-minilib.zip"):
- import sys
- sys.path.insert(0, "paver-minilib.zip")
+from setuptools import find_packages, setup
+import os.path
+import sys
+
+
+def read_project_version(package):
+ py = os.path.join(package , '__init__.py')
+ __version__ = None
+ for line in open(py).read().splitlines():
+ if '__version__' in line:
+ exec(line)
+ break
+ return __version__
+
+PACKAGE='pyvirtualdisplay'
+NAME = 'PyVirtualDisplay'
+URL = 'https://github.com/ponty/PyVirtualDisplay'
+DESCRIPTION = 'python wrapper for Xvfb, Xephyr and Xvnc'
+VERSION = read_project_version(PACKAGE)
+
+extra = {}
+if sys.version_info >= (3,):
+ extra['use_2to3'] = True
+
+classifiers = [
+ # Get more strings from http://www.python.org/pypi?%3Aaction=list_classifiers
+ "License :: OSI Approved :: BSD License",
+ "Natural Language :: English",
+ "Operating System :: OS Independent",
+ "Programming Language :: Python",
+ ]
+
+install_requires = open("requirements.txt").read().split('\n')
+
+# compatible with distutils of python 2.3+ or later
+setup(
+ name=NAME,
+ version=VERSION,
+ description=DESCRIPTION,
+ long_description=open('README.rst', 'r').read(),
+ classifiers=classifiers,
+ keywords='Xvfb Xephyr X wrapper',
+ author='ponty',
+ #author_email='',
+ url=URL,
+ license='BSD',
+ packages=find_packages(exclude=['bootstrap', 'pavement', ]),
+ include_package_data=True,
+ test_suite='nose.collector',
+ zip_safe=False,
+ install_requires=install_requires,
+ **extra
+ )
-import paver.tasks
-paver.tasks.main()
View
65 tox.ini
@@ -0,0 +1,65 @@
+
+[tox]
+envlist = py25,py26,py27,py31,py32,pypy
+
+[testenv]
+setenv=
+ PYTHONPATH=
+changedir=tests
+
+commands=nosetests
+
+[testenv:py25]
+deps=
+ nose
+ #pyscreenshot
+ #PIL
+commands=
+ nosetests -v test_core
+ python --version
+
+[testenv:py26]
+deps=
+ nose
+ pyscreenshot
+ PIL
+commands=
+ nosetests -v
+ python --version
+
+[testenv:py27]
+deps=
+ nose
+ pyscreenshot
+ PIL
+commands=
+ nosetests -v
+ python --version
+
+[testenv:py31]
+deps=
+ nose
+ #pyscreenshot
+ #PIL
+commands=
+ nosetests -v test_core test_with
+ python --version
+
+[testenv:py32]
+deps=
+ nose
+ #pyscreenshot
+ #PIL
+commands=
+ nosetests -v test_core test_with
+ python --version
+
+[testenv:pypy]
+deps=
+ nose
+ #pyscreenshot
+ #PIL
+commands=
+ nosetests -v test_core test_with
+ python --version
+

0 comments on commit 338476f

Please sign in to comment.