Package: python-tld / 0.9.1-1

remove-update-tld-utility.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
Description: Remove update-tld-names function and binary
 We don't want to update the tld-names: we don't use the file shipped in
 upstream tarball, we use the list provided but the Debian package
 publicsuffix. If an update is required, this is the publicsuffix package
 that should be upgraded.
Author: Sophie Brun <sophie@offensive-security.com>
Last-Update: 2018-10-04
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/README.rst
+++ b/README.rst
@@ -116,34 +116,6 @@ Get the first level domain name **as str
     get_fld("http://www.google.idontexist", fail_silently=True)
     # None
 
-Update the list of TLD names
-============================
-To update/sync the tld names with the most recent version run the following
-from your terminal:
-
-.. code-block:: sh
-
-    update-tld-names
-
-Or simply do:
-
-.. code-block:: python
-
-    from tld.utils import update_tld_names
-
-    update_tld_names()
-
-Troubleshooting
-===============
-If somehow domain names listed `here
-<http://mxr.mozilla.org/mozilla/source/netwerk/dns/src/effective_tld_names.dat?raw=1>`_
-are not recognised, make sure you have the most recent version of TLD names in
-your virtual environment:
-
-.. code-block:: sh
-
-    update-tld-names
-
 Testing
 =======
 Simply type:
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -116,34 +116,6 @@ Get the first level domain name **as str
     get_fld("http://www.google.idontexist", fail_silently=True)
     # None
 
-Update the list of TLD names
-============================
-To update/sync the tld names with the most recent version run the following
-from your terminal:
-
-.. code-block:: sh
-
-    update-tld-names
-
-Or simply do:
-
-.. code-block:: python
-
-    from tld.utils import update_tld_names
-
-    update_tld_names()
-
-Troubleshooting
-===============
-If somehow domain names listed `here
-<http://mxr.mozilla.org/mozilla/source/netwerk/dns/src/effective_tld_names.dat?raw=1>`_
-are not recognised, make sure you have the most recent version of TLD names in
-your virtual environment:
-
-.. code-block:: sh
-
-    update-tld-names
-
 Testing
 =======
 Simply type:
--- a/docs/tld.commands.rst
+++ b/docs/tld.commands.rst
@@ -4,14 +4,6 @@ tld.commands package
 Submodules
 ----------
 
-tld.commands.update\_tld\_names module
---------------------------------------
-
-.. automodule:: tld.commands.update_tld_names
-    :members:
-    :undoc-members:
-    :show-inheritance:
-
 
 Module contents
 ---------------
--- a/src/tld/__init__.py
+++ b/src/tld/__init__.py
@@ -4,7 +4,6 @@ from .utils import (
     get_tld_names,
     parse_tld,
     Result,
-    update_tld_names,
 )
 
 __title__ = 'tld'
@@ -18,5 +17,4 @@ __all__ = (
     'get_tld_names',
     'parse_tld',
     'Result',
-    'update_tld_names',
 )
--- a/src/tld/tests.py
+++ b/src/tld/tests.py
@@ -18,7 +18,6 @@ from .utils import (
     get_fld,
     get_tld,
     parse_tld,
-    update_tld_names,
 )
 
 __title__ = 'tld.tests'
@@ -315,13 +314,6 @@ class TldTest(unittest.TestCase):
         self.assertTrue(res)
         return res
 
-    @log_info
-    def test_1_update_tld_names(self):
-        """Test updating the tld names (re-fetch mozilla source)."""
-        res = update_tld_names(fail_silently=True)
-        self.assertTrue(res)
-        return res
-
     @log_info
     def test_2_fld_good_patterns_pass(self):
         """Test good URL patterns."""
--- a/src/tld/utils.py
+++ b/src/tld/utils.py
@@ -25,7 +25,6 @@ __all__ = (
     'get_tld_names',
     'process_url',
     'Result',
-    'update_tld_names',
     'parse_tld',
 )
 
@@ -143,35 +142,6 @@ class Trie(object):
         self.__nodes += 1
 
 
-def update_tld_names(fail_silently=False):
-    """Update the local copy of TLDs file.
-
-    :param fail_silently: If set to True, no exceptions is raised on
-        failure but boolean False returned.
-    :type fail_silently: bool
-    :return: True on success, False on failure.
-    :rtype: bool
-    """
-    tld_names_source_url = get_setting('NAMES_SOURCE_URL')
-    tld_names_local_path = get_setting('NAMES_LOCAL_PATH')
-    try:
-        remote_file = urlopen(tld_names_source_url)
-        local_file = codecs.open(
-            project_dir(tld_names_local_path),
-            'wb',
-            encoding='utf8'
-        )
-        local_file.write(remote_file.read().decode('utf8'))
-        local_file.close()
-        remote_file.close()
-    except Exception as err:
-        if fail_silently:
-            return False
-        raise TldIOError(err)
-
-    return True
-
-
 def get_tld_names(fail_silently=False, retry_count=0):
     """Build the ``tlds`` list if empty. Recursive.
 
@@ -223,7 +193,6 @@ def get_tld_names(fail_silently=False, r
 
         local_file.close()
     except IOError as err:
-        update_tld_names()  # Grab the file
         # Increment ``retry_count`` in order to avoid infinite loops
         retry_count += 1
         return get_tld_names(fail_silently, retry_count)  # Run again
--- a/setup.py
+++ b/setup.py
@@ -8,13 +8,6 @@ except:
 
 version = '0.9.1'
 
-exec_dirs = [
-    'src/tld/bin/',
-]
-execs = []
-for exec_dir in exec_dirs:
-    execs += [os.path.join(exec_dir, f) for f in os.listdir(exec_dir)]
-
 setup(
     name='tld',
     version=version,
@@ -45,8 +38,6 @@ setup(
     url='https://github.com/barseghyanartur/tld',
     package_dir={'': 'src'},
     packages=find_packages(where='./src'),
-    package_data={'tld': execs},
-    scripts=['src/tld/bin/update-tld-names',],
     include_package_data=True,
     license='MPL 1.1/GPL 2.0/LGPL 2.1',
     install_requires=[