Skip to content

Scrapy, a fast high-level web crawling & scraping framework for Python.

Remove deprecated xlib module

Eugenio Lacuestac5612f387bcf
diff --git a/.coveragerc b/.coveragerc
index 914d697a0..02acbff8e 100644
--- a/.coveragerc
+++ b/.coveragerc
@@ -3,4 +3,3 @@ branch = true
include = scrapy/*
omit =
tests/*
- scrapy/xlib/*
diff --git a/conftest.py b/conftest.py
index d8531d6cc..06d65ba1d 100644
--- a/conftest.py
+++ b/conftest.py
@@ -1,22 +1,12 @@
-import glob
import six
import pytest
-from twisted import version as twisted_version
-
-
-def _py_files(folder):
- return glob.glob(folder + "/*.py") + glob.glob(folder + "/*/*.py")
collect_ignore = [
# not a test, but looks like a test
"scrapy/utils/testsite.py",
-
]
-if (twisted_version.major, twisted_version.minor, twisted_version.micro) >= (15, 5, 0):
- collect_ignore += _py_files("scrapy/xlib/tx")
-
if six.PY3:
for line in open('tests/py3-ignores.txt'):
diff --git a/debian/scrapy.lintian-overrides b/debian/scrapy.lintian-overrides
index 955e7def0..b5de7f67d 100644
--- a/debian/scrapy.lintian-overrides
+++ b/debian/scrapy.lintian-overrides
@@ -1,2 +1 @@
new-package-should-close-itp-bug
-extra-license-file usr/share/pyshared/scrapy/xlib/pydispatch/license.txt
diff --git a/scrapy/xlib/__init__.py b/scrapy/xlib/__init__.py
deleted file mode 100644
index 11f022087..000000000
--- a/scrapy/xlib/__init__.py
+++ /dev/null
@@ -1,2 +0,0 @@
-"""This package contains some third party modules that are distributed along
-with Scrapy"""
diff --git a/scrapy/xlib/pydispatch.py b/scrapy/xlib/pydispatch.py
deleted file mode 100644
index 5ffeaf579..000000000
--- a/scrapy/xlib/pydispatch.py
+++ /dev/null
@@ -1,19 +0,0 @@
-from __future__ import absolute_import
-
-import warnings
-from scrapy.exceptions import ScrapyDeprecationWarning
-
-from pydispatch import (
- dispatcher,
- errors,
- robust,
- robustapply,
- saferef,
-)
-
-warnings.warn("Importing from scrapy.xlib.pydispatch is deprecated and will"
- " no longer be supported in future Scrapy versions."
- " If you just want to connect signals use the from_crawler class method,"
- " otherwise import pydispatch directly if needed."
- " See: https://github.com/scrapy/scrapy/issues/1762",
- ScrapyDeprecationWarning, stacklevel=2)
diff --git a/scrapy/xlib/tx.py b/scrapy/xlib/tx.py
deleted file mode 100644
index 0d94307b7..000000000
--- a/scrapy/xlib/tx.py
+++ /dev/null
@@ -1,19 +0,0 @@
-from __future__ import absolute_import
-
-import warnings
-from scrapy.exceptions import ScrapyDeprecationWarning
-
-from twisted.web import client
-from twisted.internet import endpoints
-
-Agent = client.Agent # since < 11.1
-ProxyAgent = client.ProxyAgent # since 11.1
-ResponseDone = client.ResponseDone # since 11.1
-ResponseFailed = client.ResponseFailed # since 11.1
-HTTPConnectionPool = client.HTTPConnectionPool # since 12.1
-TCP4ClientEndpoint = endpoints.TCP4ClientEndpoint # since 10.1
-
-warnings.warn("Importing from scrapy.xlib.tx is deprecated and will"
- " no longer be supported in future Scrapy versions."
- " Update your code to import from twisted proper.",
- ScrapyDeprecationWarning, stacklevel=2)
diff --git a/tests/test_pydispatch_deprecated.py b/tests/test_pydispatch_deprecated.py
deleted file mode 100644
index 6d3237fe1..000000000
--- a/tests/test_pydispatch_deprecated.py
+++ /dev/null
@@ -1,12 +0,0 @@
-import unittest
-import warnings
-from six.moves import reload_module
-
-
-class DeprecatedPydispatchTest(unittest.TestCase):
- def test_import_xlib_pydispatch_show_warning(self):
- with warnings.catch_warnings(record=True) as w:
- from scrapy.xlib import pydispatch
- reload_module(pydispatch)
- self.assertIn('Importing from scrapy.xlib.pydispatch is deprecated',
- str(w[0].message))