summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeonard Richardson <leonard.richardson@canonical.com>2009-04-10 11:22:53 -0400
committerLeonard Richardson <leonard.richardson@canonical.com>2009-04-10 11:22:53 -0400
commite2cdc424ee48a38a6217f3eb0ca6adf513694a84 (patch)
tree58b8fd1855e139909dba2e0d16d7d369281ba4d2
parentbb77aa085be6c116d0e74b6beaab42b69f691ea4 (diff)
First attempt at an import.
-rw-r--r--_bootstrap/COPYRIGHT.txt9
-rw-r--r--_bootstrap/LICENSE.txt54
-rw-r--r--_bootstrap/bootstrap.py77
l---------bootstrap.py1
-rw-r--r--setup.py100
-rw-r--r--src/beautifulsoup/AUTHORS (renamed from AUTHORS)0
-rw-r--r--src/beautifulsoup/CHANGELOG (renamed from CHANGELOG)0
-rw-r--r--src/beautifulsoup/README (renamed from README)0
-rw-r--r--src/beautifulsoup/TODO (renamed from TODO)0
-rw-r--r--src/beautifulsoup/__init__.py (renamed from BeautifulSoup.py)0
-rw-r--r--src/beautifulsoup/builder.py (renamed from builder.py)0
-rw-r--r--src/beautifulsoup/builder.py.3.diff (renamed from builder.py.3.diff)0
-rw-r--r--src/beautifulsoup/dammit.py (renamed from dammit.py)0
-rw-r--r--src/beautifulsoup/dammit.py.3.diff (renamed from dammit.py.3.diff)0
-rw-r--r--src/beautifulsoup/docs/__init__.py16
-rw-r--r--src/beautifulsoup/element.py (renamed from element.py)0
-rw-r--r--src/beautifulsoup/element.py.3.diff (renamed from element.py.3.diff)0
-rw-r--r--src/beautifulsoup/tests/__init__.py16
-rw-r--r--src/beautifulsoup/tests/test_docs.py51
-rw-r--r--src/beautifulsoup/tests/test_docs.py.3.diff (renamed from BeautifulSoupTests.py.3.diff)0
-rw-r--r--src/beautifulsoup/tests/test_soup.py (renamed from BeautifulSoupTests.py)2
-rw-r--r--src/beautifulsoup/util.py (renamed from util.py)0
22 files changed, 265 insertions, 61 deletions
diff --git a/_bootstrap/COPYRIGHT.txt b/_bootstrap/COPYRIGHT.txt
new file mode 100644
index 0000000..0e07bd9
--- /dev/null
+++ b/_bootstrap/COPYRIGHT.txt
@@ -0,0 +1,9 @@
+Copyright (c) 2004-2009 Zope Corporation and Contributors.
+All Rights Reserved.
+
+This software is subject to the provisions of the Zope Public License,
+Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
+THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+FOR A PARTICULAR PURPOSE.
diff --git a/_bootstrap/LICENSE.txt b/_bootstrap/LICENSE.txt
new file mode 100644
index 0000000..eeb9ddf
--- /dev/null
+++ b/_bootstrap/LICENSE.txt
@@ -0,0 +1,54 @@
+Zope Public License (ZPL) Version 2.1
+-------------------------------------
+
+A copyright notice accompanies this license document that
+identifies the copyright holders.
+
+This license has been certified as open source. It has also
+been designated as GPL compatible by the Free Software
+Foundation (FSF).
+
+Redistribution and use in source and binary forms, with or
+without modification, are permitted provided that the
+following conditions are met:
+
+1. Redistributions in source code must retain the
+ accompanying copyright notice, this list of conditions,
+ and the following disclaimer.
+
+2. Redistributions in binary form must reproduce the accompanying
+ copyright notice, this list of conditions, and the
+ following disclaimer in the documentation and/or other
+ materials provided with the distribution.
+
+3. Names of the copyright holders must not be used to
+ endorse or promote products derived from this software
+ without prior written permission from the copyright
+ holders.
+
+4. The right to distribute this software or to use it for
+ any purpose does not give you the right to use
+ Servicemarks (sm) or Trademarks (tm) of the copyright
+ holders. Use of them is covered by separate agreement
+ with the copyright holders.
+
+5. If any files are modified, you must cause the modified
+ files to carry prominent notices stating that you changed
+ the files and the date of any change.
+
+Disclaimer
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS''
+ AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
+ NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
+ NO EVENT SHALL THE COPYRIGHT HOLDERS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGE. \ No newline at end of file
diff --git a/_bootstrap/bootstrap.py b/_bootstrap/bootstrap.py
new file mode 100644
index 0000000..7728587
--- /dev/null
+++ b/_bootstrap/bootstrap.py
@@ -0,0 +1,77 @@
+##############################################################################
+#
+# Copyright (c) 2006 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""Bootstrap a buildout-based project
+
+Simply run this script in a directory containing a buildout.cfg.
+The script accepts buildout command-line options, so you can
+use the -c option to specify an alternate configuration file.
+
+$Id$
+"""
+
+import os, shutil, sys, tempfile, urllib2
+
+tmpeggs = tempfile.mkdtemp()
+
+is_jython = sys.platform.startswith('java')
+
+try:
+ import pkg_resources
+except ImportError:
+ ez = {}
+ exec urllib2.urlopen('http://peak.telecommunity.com/dist/ez_setup.py'
+ ).read() in ez
+ ez['use_setuptools'](to_dir=tmpeggs, download_delay=0)
+
+ import pkg_resources
+
+if sys.platform == 'win32':
+ def quote(c):
+ if ' ' in c:
+ return '"%s"' % c # work around spawn lamosity on windows
+ else:
+ return c
+else:
+ def quote (c):
+ return c
+
+cmd = 'from setuptools.command.easy_install import main; main()'
+ws = pkg_resources.working_set
+
+if is_jython:
+ import subprocess
+
+ assert subprocess.Popen([sys.executable] + ['-c', quote(cmd), '-mqNxd',
+ quote(tmpeggs), 'zc.buildout'],
+ env=dict(os.environ,
+ PYTHONPATH=
+ ws.find(pkg_resources.Requirement.parse('setuptools')).location
+ ),
+ ).wait() == 0
+
+else:
+ assert os.spawnle(
+ os.P_WAIT, sys.executable, quote (sys.executable),
+ '-c', quote (cmd), '-mqNxd', quote (tmpeggs), 'zc.buildout',
+ dict(os.environ,
+ PYTHONPATH=
+ ws.find(pkg_resources.Requirement.parse('setuptools')).location
+ ),
+ ) == 0
+
+ws.add_entry(tmpeggs)
+ws.require('zc.buildout')
+import zc.buildout.buildout
+zc.buildout.buildout.main(sys.argv[1:] + ['bootstrap'])
+shutil.rmtree(tmpeggs)
diff --git a/bootstrap.py b/bootstrap.py
new file mode 120000
index 0000000..44defc0
--- /dev/null
+++ b/bootstrap.py
@@ -0,0 +1 @@
+_bootstrap/bootstrap.py \ No newline at end of file
diff --git a/setup.py b/setup.py
index f271eb1..c0ed167 100644
--- a/setup.py
+++ b/setup.py
@@ -1,64 +1,44 @@
-from distutils.core import setup
-import unittest
-import warnings
-warnings.filterwarnings("ignore", "Unknown distribution option")
+#!/usr/bin/env python
-import sys
-# patch distutils if it can't cope with the "classifiers" keyword
-if sys.version < '2.2.3':
- from distutils.dist import DistributionMetadata
- DistributionMetadata.classifiers = None
- DistributionMetadata.download_url = None
+import ez_setup
+ez_setup.use_setuptools()
-from BeautifulSoup import __version__
+import sys
+from setuptools import setup, find_packages
-#Make sure all the tests complete.
-import BeautifulSoupTests
-loader = unittest.TestLoader()
-result = unittest.TestResult()
-suite = loader.loadTestsFromModule(BeautifulSoupTests)
-suite.run(result)
-if not result.wasSuccessful():
- print "Unit tests have failed!"
- for l in result.errors, result.failures:
- for case, error in l:
- print "-" * 80
- desc = case.shortDescription()
- if desc:
- print desc
- print error
- print '''If you see an error like: "'ascii' codec can't encode character...", see\nthe Beautiful Soup documentation:\n http://www.crummy.com/software/BeautifulSoup/documentation.html#Why%20can't%20Beautiful%20Soup%20print%20out%20the%20non-ASCII%20characters%20I%20gave%20it?'''
- print "This might or might not be a problem depending on what you plan to do with\nBeautiful Soup."
- if sys.argv[1] == 'sdist':
- print
- print "I'm not going to make a source distribution since the tests don't pass."
- sys.exit(1)
+sys.path.insert(0, 'src')
+from beautifulsoup import __version__
-setup(name="BeautifulSoup",
- version=__version__,
- py_modules=['BeautifulSoup', 'BeautifulSoupTests'],
- scripts=['testall.sh', 'to3.sh',
- # Whatever, I'll fix this later.
- 'README', 'CHANGELOG',
- 'BeautifulSoup.py.3.diff', 'BeautifulSoupTests.py.3.diff'],
- description="HTML/XML parser for quick-turnaround applications like screen-scraping.",
- author="Leonard Richardson",
- author_email = "leonardr@segfault.org",
- long_description="""Beautiful Soup parses arbitrarily invalid SGML and provides a variety of methods and Pythonic idioms for iterating and searching the parse tree.""",
- classifiers=["Development Status :: 5 - Production/Stable",
- "Intended Audience :: Developers",
- "License :: OSI Approved :: Python Software Foundation License",
- "Programming Language :: Python",
- "Topic :: Text Processing :: Markup :: HTML",
- "Topic :: Text Processing :: Markup :: XML",
- "Topic :: Text Processing :: Markup :: SGML",
- "Topic :: Software Development :: Libraries :: Python Modules",
- ],
- url="http://www.crummy.com/software/BeautifulSoup/",
- license="BSD",
- download_url="http://www.crummy.com/software/BeautifulSoup/download/"
- )
-
- # Send announce to:
- # python-announce@python.org
- # python-list@python.org
+setup(
+ name='beautifulsoup',
+ version=__version__,
+ packages=find_packages('src'),
+ package_dir={'':'src'},
+ include_package_data=True,
+ zip_safe=False,
+ maintainer='Leonard Richardson',
+ maintainer_email='leonardr@segfault.org',
+ long_description="""Beautiful Soup parses arbitrarily invalid XML/HTML and provides a variety of methods and Pythonic idioms for iterating and searching the parse tree."""
+ license='New-style BSD',
+ install_requires=[
+ 'setuptools',
+ 'zope.interface',
+ ],
+ url='https://launchpad.net/beautifulsoup',
+ download_url= 'https://launchpad.net/beautifulsoup/+download',
+ classifiers=["Development Status :: 5 - Production/Stable",
+ "Intended Audience :: Developers",
+ "License :: OSI Approved :: Python Software Foundation License",
+ "Programming Language :: Python",
+ "Topic :: Text Processing :: Markup :: HTML",
+ "Topic :: Text Processing :: Markup :: XML",
+ "Topic :: Text Processing :: Markup :: SGML",
+ "Topic :: Software Development :: Libraries :: Python Modules",
+ ],
+ extras_require=dict(
+ docs=['Sphinx',
+ 'z3c.recipe.sphinxdoc']
+ ),
+ setup_requires=['eggtestinfo', 'setuptools_bzr'],
+ test_suite='beautifulsoup.tests',
+ )
diff --git a/AUTHORS b/src/beautifulsoup/AUTHORS
index d353253..d353253 100644
--- a/AUTHORS
+++ b/src/beautifulsoup/AUTHORS
diff --git a/CHANGELOG b/src/beautifulsoup/CHANGELOG
index 4e97e1b..4e97e1b 100644
--- a/CHANGELOG
+++ b/src/beautifulsoup/CHANGELOG
diff --git a/README b/src/beautifulsoup/README
index 8feac71..8feac71 100644
--- a/README
+++ b/src/beautifulsoup/README
diff --git a/TODO b/src/beautifulsoup/TODO
index 84fa273..84fa273 100644
--- a/TODO
+++ b/src/beautifulsoup/TODO
diff --git a/BeautifulSoup.py b/src/beautifulsoup/__init__.py
index 0999c07..0999c07 100644
--- a/BeautifulSoup.py
+++ b/src/beautifulsoup/__init__.py
diff --git a/builder.py b/src/beautifulsoup/builder.py
index aeae1e8..aeae1e8 100644
--- a/builder.py
+++ b/src/beautifulsoup/builder.py
diff --git a/builder.py.3.diff b/src/beautifulsoup/builder.py.3.diff
index 91b510d..91b510d 100644
--- a/builder.py.3.diff
+++ b/src/beautifulsoup/builder.py.3.diff
diff --git a/dammit.py b/src/beautifulsoup/dammit.py
index 78bd4b2..78bd4b2 100644
--- a/dammit.py
+++ b/src/beautifulsoup/dammit.py
diff --git a/dammit.py.3.diff b/src/beautifulsoup/dammit.py.3.diff
index f6bab68..f6bab68 100644
--- a/dammit.py.3.diff
+++ b/src/beautifulsoup/dammit.py.3.diff
diff --git a/src/beautifulsoup/docs/__init__.py b/src/beautifulsoup/docs/__init__.py
new file mode 100644
index 0000000..93d8446
--- /dev/null
+++ b/src/beautifulsoup/docs/__init__.py
@@ -0,0 +1,16 @@
+# Copyright 2009 Canonical Ltd. All rights reserved.
+#
+# This file is part of beautifulsoup
+#
+# beautifulsoup is free software: you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation, version 3 of the License.
+#
+# beautifulsoup is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+# License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with beautifulsoup. If not, see <http://www.gnu.org/licenses/>.
+"""Executable documentation about beautifulsoup."""
diff --git a/element.py b/src/beautifulsoup/element.py
index 3bdb01f..3bdb01f 100644
--- a/element.py
+++ b/src/beautifulsoup/element.py
diff --git a/element.py.3.diff b/src/beautifulsoup/element.py.3.diff
index 4549edd..4549edd 100644
--- a/element.py.3.diff
+++ b/src/beautifulsoup/element.py.3.diff
diff --git a/src/beautifulsoup/tests/__init__.py b/src/beautifulsoup/tests/__init__.py
new file mode 100644
index 0000000..71c3f97
--- /dev/null
+++ b/src/beautifulsoup/tests/__init__.py
@@ -0,0 +1,16 @@
+# Copyright 2009 Canonical Ltd. All rights reserved.
+#
+# This file is part of beautifulsoup
+#
+# beautifulsoup is free software: you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation, version 3 of the License.
+#
+# beautifulsoup is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+# License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with beautifulsoup. If not, see <http://www.gnu.org/licenses/>.
+"The beautifulsoup tests."
diff --git a/src/beautifulsoup/tests/test_docs.py b/src/beautifulsoup/tests/test_docs.py
new file mode 100644
index 0000000..51a53f7
--- /dev/null
+++ b/src/beautifulsoup/tests/test_docs.py
@@ -0,0 +1,51 @@
+# Copyright 2009 Canonical Ltd. All rights reserved.
+#
+# This file is part of beautifulsoup
+#
+# beautifulsoup is free software: you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation, version 3 of the License.
+#
+# beautifulsoup is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+# License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with beautifulsoup. If not, see <http://www.gnu.org/licenses/>.
+"Test harness for doctests."
+
+# pylint: disable-msg=E0611,W0142
+
+__metaclass__ = type
+__all__ = [
+ 'additional_tests',
+ ]
+
+import atexit
+import doctest
+import os
+from pkg_resources import (
+ resource_filename, resource_exists, resource_listdir, cleanup_resources)
+import unittest
+
+DOCTEST_FLAGS = (
+ doctest.ELLIPSIS |
+ doctest.NORMALIZE_WHITESPACE |
+ doctest.REPORT_NDIFF)
+
+
+def additional_tests():
+ "Run the doc tests (README.txt and docs/*, if any exist)"
+ doctest_files = [
+ os.path.abspath(resource_filename('beautifulsoup', 'README.txt'))]
+ if resource_exists('beautifulsoup', 'docs'):
+ for name in resource_listdir('beautifulsoup', 'docs'):
+ if name.endswith('.txt'):
+ doctest_files.append(
+ os.path.abspath(
+ resource_filename('beautifulsoup', 'docs/%s' % name)))
+ kwargs = dict(module_relative=False, optionflags=DOCTEST_FLAGS)
+ atexit.register(cleanup_resources)
+ return unittest.TestSuite((
+ doctest.DocFileSuite(*doctest_files, **kwargs)))
diff --git a/BeautifulSoupTests.py.3.diff b/src/beautifulsoup/tests/test_docs.py.3.diff
index fc9636c..fc9636c 100644
--- a/BeautifulSoupTests.py.3.diff
+++ b/src/beautifulsoup/tests/test_docs.py.3.diff
diff --git a/BeautifulSoupTests.py b/src/beautifulsoup/tests/test_soup.py
index 7b29c94..e7e5680 100644
--- a/BeautifulSoupTests.py
+++ b/src/beautifulsoup/tests/test_soup.py
@@ -7,7 +7,7 @@ case like this that fails."""
import re
import unittest
-from BeautifulSoup import *
+from beautifulsoup import *
from element import CData, Comment, Declaration, SoupStrainer, Tag
from builder import ICantBelieveItsValidHTMLTreeBuilder
from dammit import UnicodeDammit
diff --git a/util.py b/src/beautifulsoup/util.py
index 693a7e2..693a7e2 100644
--- a/util.py
+++ b/src/beautifulsoup/util.py