summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTorsten Marek <shlomme@gmail.com>2014-11-08 23:07:18 +0100
committerTorsten Marek <shlomme@gmail.com>2014-11-08 23:07:18 +0100
commit206aceba12b2aa9b8cce7fd0681905239e0f0cc5 (patch)
treefb7cb21e472b6a7383cbba781aa542d8ebd66d91
parent003649ec029570fa41d6842faac436112fe88f4e (diff)
downloadastroid-206aceba12b2aa9b8cce7fd0681905239e0f0cc5.tar.gz
Simplify setup.py and update documentation for Python 3 changes.
-rw-r--r--MANIFEST.in5
-rw-r--r--README9
-rw-r--r--README.Python326
-rw-r--r--__pkginfo__.py7
-rw-r--r--setup.py126
-rwxr-xr-xtest/fulltest.sh17
-rw-r--r--tox.ini3
7 files changed, 29 insertions, 164 deletions
diff --git a/MANIFEST.in b/MANIFEST.in
index 7e16270..e9b7008 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -1,10 +1,9 @@
include ChangeLog
-include README*
+include README
include COPYING
include COPYING.LESSER
-include test/fulltest.sh
recursive-include test/data *.py *.zip *.egg
recursive-include test/data_py3 *.py *.zip *.egg
recursive-include test/data2 *.py
recursive-include test/regrtest_data *.py
-recursive-include brain *.py
+recursive-include brain/ *.py
diff --git a/README b/README
index 426fbd7..3435b47 100644
--- a/README
+++ b/README
@@ -45,12 +45,17 @@ http://mail.python.org/mailman/listinfo/code-quality for subscription
information and archives. You may find older archives at
http://lists.logilab.org/mailman/listinfo/python-projects .
+Python Versions
+---------------
+
+astroid is compatible with Python 2.7 as well as 3.3 and later. astroid uses
+the same code base for both Python versions, using six.
+
Test
----
Tests are in the 'test' subdirectory. To launch the whole tests suite
at once, you may use the 'pytest' utility from logilab-common (simply
-type 'pytest' from within this directory) or if you're running python
->= 2.7, using discover, for instance::
+type 'pytest' from within this directory) or using unittest discover::
python -m unittest discover -p "unittest*.py"
diff --git a/README.Python3 b/README.Python3
deleted file mode 100644
index 55ea159..0000000
--- a/README.Python3
+++ /dev/null
@@ -1,26 +0,0 @@
-Python3
-=======
-
-Approach
---------
-
-We maintain a Python 2 base and use 2to3 to generate Python 3 code.
-
-2to3 is integrated into the distutils installation process and will be run as a
-build step when invoked by the python3 interpreter::
-
- python3 setup.py install --no-compile
-
-
-Debian
-------
-
-For the Debian packaging, you can use the debian.py3k/ content against
-the debian/ folder::
-
- cp debian.py3k/* debian/
-
-
-Resources
----------
-http://wiki.python.org/moin/PortingPythonToPy3k
diff --git a/__pkginfo__.py b/__pkginfo__.py
index 43b8ccd..a93173f 100644
--- a/__pkginfo__.py
+++ b/__pkginfo__.py
@@ -16,7 +16,6 @@
# You should have received a copy of the GNU Lesser General Public License along
# with astroid. If not, see <http://www.gnu.org/licenses/>.
"""astroid packaging information"""
-
distname = 'astroid'
modname = 'astroid'
@@ -35,12 +34,6 @@ web = 'http://bitbucket.org/logilab/astroid'
description = "rebuild a new abstract syntax tree from Python's ast"
-from os.path import join
-include_dirs = ['brain',
- join('test', 'regrtest_data'),
- join('test', 'data'), join('test', 'data_py3'), join('test', 'data2')
- ]
-
classifiers = ["Topic :: Software Development :: Libraries :: Python Modules",
"Topic :: Software Development :: Quality Assurance",
"Programming Language :: Python",
diff --git a/setup.py b/setup.py
index 0755656..2e4f853 100644
--- a/setup.py
+++ b/setup.py
@@ -23,21 +23,9 @@ __docformat__ = "restructuredtext en"
import os
import sys
-import shutil
from os.path import isdir, exists, join
-try:
- if os.environ.get('NO_SETUPTOOLS'):
- raise ImportError()
- from setuptools import setup
- from setuptools.command import install_lib
- USE_SETUPTOOLS = 1
-except ImportError:
- from distutils.core import setup
- from distutils.command import install_lib
- USE_SETUPTOOLS = 0
-
-from distutils.command.build_py import build_py
+from setuptools import setup
sys.modules.pop('__pkginfo__', None)
# import optional features
@@ -47,109 +35,21 @@ from __pkginfo__ import modname, version, license, description, \
web, author, author_email
distname = getattr(__pkginfo__, 'distname', modname)
-scripts = getattr(__pkginfo__, 'scripts', [])
data_files = getattr(__pkginfo__, 'data_files', None)
-subpackage_of = getattr(__pkginfo__, 'subpackage_of', None)
include_dirs = getattr(__pkginfo__, 'include_dirs', [])
-ext_modules = getattr(__pkginfo__, 'ext_modules', None)
install_requires = getattr(__pkginfo__, 'install_requires', None)
-dependency_links = getattr(__pkginfo__, 'dependency_links', [])
classifiers = getattr(__pkginfo__, 'classifiers', [])
-STD_BLACKLIST = ('CVS', '.svn', '.hg', 'debian', 'dist', 'build')
-
-IGNORED_EXTENSIONS = ('.pyc', '.pyo', '.elc', '~')
-
if exists('README'):
long_description = open('README').read()
else:
long_description = ''
-def ensure_scripts(linux_scripts):
- """Creates the proper script names required for each platform
- (taken from 4Suite)
- """
- from distutils import util
- if util.get_platform()[:3] == 'win':
- scripts_ = [script + '.bat' for script in linux_scripts]
- else:
- scripts_ = linux_scripts
- return scripts_
-
-def get_packages(directory, prefix):
- """return a list of subpackages for the given directory"""
- result = []
- for package in os.listdir(directory):
- absfile = join(directory, package)
- if isdir(absfile):
- if exists(join(absfile, '__init__.py')) or \
- package in ('test', 'tests'):
- if prefix:
- result.append('%s.%s' % (prefix, package))
- else:
- result.append(package)
- result += get_packages(absfile, result[-1])
- return result
-
-EMPTY_FILE = '''"""generated file, don't modify or your data will be lost"""
-try:
- __import__('pkg_resources').declare_namespace(__name__)
-except ImportError:
- pass
-'''
-
-class MyInstallLib(install_lib.install_lib):
- """extend install_lib command to handle package __init__.py if necessary
- """
- def run(self):
- """overridden from install_lib class"""
- install_lib.install_lib.run(self)
- # create Products.__init__.py if needed
- if subpackage_of:
- product_init = join(self.install_dir, subpackage_of, '__init__.py')
- if not exists(product_init):
- self.announce('creating %s' % product_init)
- stream = open(product_init, 'w')
- stream.write(EMPTY_FILE)
- stream.close()
-
-
-class MyBuildPy(build_py):
- """extend build_by command to handle include_dirs variable if necessary
- """
- def run(self):
- """overridden from install_lib class"""
- build_py.run(self)
- # manually install included directories if any
- if include_dirs:
- if subpackage_of:
- base = join(subpackage_of, modname)
- else:
- base = modname
- basedir = os.path.join(self.build_lib, base)
- for directory in include_dirs:
- dest = join(basedir, directory)
- shutil.rmtree(dest, ignore_errors=True)
- shutil.copytree(directory, dest)
def install(**kwargs):
"""setup entry point"""
- if USE_SETUPTOOLS:
- if '--force-manifest' in sys.argv:
- sys.argv.remove('--force-manifest')
- if subpackage_of:
- package = subpackage_of + '.' + modname
- kwargs['package_dir'] = {package : '.'}
- packages = [package] + get_packages(os.getcwd(), package)
- if USE_SETUPTOOLS:
- kwargs['namespace_packages'] = [subpackage_of]
- else:
- kwargs['package_dir'] = {modname : '.'}
- packages = [modname] + get_packages(os.getcwd(), modname)
- if USE_SETUPTOOLS and install_requires:
- kwargs['install_requires'] = install_requires
- kwargs['dependency_links'] = dependency_links
- kwargs['packages'] = packages
+ if '--force-manifest' in sys.argv:
+ sys.argv.remove('--force-manifest')
return setup(name = distname,
version = version,
license = license,
@@ -159,11 +59,23 @@ def install(**kwargs):
author = author,
author_email = author_email,
url = web,
- scripts = ensure_scripts(scripts),
data_files = data_files,
- ext_modules = ext_modules,
- cmdclass = {'install_lib': MyInstallLib,
- 'build_py': MyBuildPy},
+ include_package_data = True,
+ install_requires = install_requires,
+ package_dir = {modname: '.'},
+ packages = [modname],
+ package_data = {
+ '': ['brain/*.py',
+ 'test/regrtest_data/absimp/*.py',
+ 'test/regrtest_data/package/*.py',
+ 'test/regrtest_data/package/subpackage/*.py',
+ 'test/regrtest_data/absimp/sidepackage/*.py',
+ 'test/regrtest_data/unicode_package/*.py',
+ 'test/regrtest_data/unicode_package/core/*.py',
+ 'test/data*/*.egg',
+ 'test/data*/*.zip',
+ ],
+ },
**kwargs
)
diff --git a/test/fulltest.sh b/test/fulltest.sh
deleted file mode 100755
index 44999b4..0000000
--- a/test/fulltest.sh
+++ /dev/null
@@ -1,17 +0,0 @@
-#!/bin/sh
-
-if [ $# -ne 0 ] ; then
- PYVERSIONS=$@
-else
- PYVERSIONS="2.5 2.6 2.7 3.2 3.3"
-fi
-PYTEST=`which pytest`
-for ver in $PYVERSIONS; do
- echo "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"
- echo `python$ver -V`
- echo "^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^"
- python$ver $PYTEST
- echo "^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^"
- echo `python$ver -V` -OO
- python$ver -OO $PYTEST
-done
diff --git a/tox.ini b/tox.ini
index 3c6b21d..3a0244f 100644
--- a/tox.ini
+++ b/tox.ini
@@ -1,7 +1,6 @@
[tox]
# official list is
-#envlist = py25, py26, py27, py32, py33
-# though 2.5 support is known to be broken...
+#envlist = py27, py33, py34
envlist = py27, py33
[testenv]
deps =