-
Notifications
You must be signed in to change notification settings - Fork 84
Expand file tree
/
Copy pathconstants.py
More file actions
384 lines (334 loc) · 13.5 KB
/
constants.py
File metadata and controls
384 lines (334 loc) · 13.5 KB
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
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
import os
from urllib.parse import urljoin
PULP_FIXTURES_BASE_URL = os.environ.get(
"REMOTE_FIXTURES_ORIGIN", "https://fixtures.pulpproject.org/"
)
PYPI_URL = "https://pypi.org/"
PYTHON_CONTENT_NAME = "python.python"
PYTHON_FIXTURES_URL = urljoin(PULP_FIXTURES_BASE_URL, "python-pypi/")
PULP_PYPI_BASE_URL = "/pypi/"
# Specifier for testing empty syncs, or no excludes
PYTHON_EMPTY_PROJECT_SPECIFIER = []
# Specifier that includes projects that aren't in the test fixtures
PYTHON_UNAVAILABLE_PROJECT_SPECIFIER = [
"shelf-reader", # matches 2
"aiohttp>=3.2.0,<3.3.1", # matches 3
"flake8", # matches 0
"pyramid", # matches 0
"pylint", # matches 0
]
PYTHON_UNAVAILABLE_PACKAGE_COUNT = 5
PYTHON_UNAVAILABLE_FIXTURE_SUMMARY = {PYTHON_CONTENT_NAME: PYTHON_UNAVAILABLE_PACKAGE_COUNT}
# no "name" field
PYTHON_INVALID_SPECIFIER_NO_NAME = [
"",
]
# invalid "version_specifier" field
PYTHON_INVALID_SPECIFIER_BAD_VERSION = [
"shelf-reader$3",
]
# no "version_specifier" field
PYTHON_VALID_SPECIFIER_NO_VERSION = ["shelf-reader"]
# Specifier for testing that the correct number of packages are synced when prereleases
# is set True or False on the remote.
PYTHON_PRERELEASE_TEST_SPECIFIER = [
# matches 2 w/ prereleases, 1 w/o
"aiohttp>3.3.1,<=3.3.2",
# matches 13 w/ prereleases, 9 w/o
"celery",
# matches 31 w/ prereleases, 20 w/o
"Django",
]
PYTHON_WITH_PRERELEASE_COUNT = 46
PYTHON_WITH_PRERELEASE_FIXTURE_SUMMARY = {PYTHON_CONTENT_NAME: PYTHON_WITH_PRERELEASE_COUNT}
PYTHON_WITHOUT_PRERELEASE_COUNT = 30
PYTHON_WITHOUT_PRERELEASE_FIXTURE_SUMMARY = {PYTHON_CONTENT_NAME: PYTHON_WITHOUT_PRERELEASE_COUNT}
# Specifier for basic sync / publish tests.
PYTHON_XS_PROJECT_SPECIFIER = ["shelf-reader"] # matches 2
PYTHON_XS_PACKAGE_COUNT = 2
PYTHON_XS_FIXTURE_SUMMARY = {PYTHON_CONTENT_NAME: PYTHON_XS_PACKAGE_COUNT}
PYTHON_SM_PROJECT_SPECIFIER = [
"aiohttp>=3.2.0,<3.3.1", # matches 3
"celery>4.1.0,<=4.2.0", # matches 2
"Django>1.10.0,<1.10.5", # matches 8
]
PYTHON_SM_PACKAGE_COUNT = 13
PYTHON_SM_FIXTURE_SUMMARY = {PYTHON_CONTENT_NAME: PYTHON_SM_PACKAGE_COUNT}
PYTHON_SM_FIXTURE_RELEASES = {
"aiohttp": ["aiohttp-3.3.0.tar.gz", "aiohttp-3.2.1.tar.gz", "aiohttp-3.2.0.tar.gz"],
"Django": [
"Django-1.10.4.tar.gz",
"Django-1.10.4-py2.py3-none-any.whl",
"Django-1.10.3.tar.gz",
"Django-1.10.3-py2.py3-none-any.whl",
"Django-1.10.2.tar.gz",
"Django-1.10.2-py2.py3-none-any.whl",
"Django-1.10.1.tar.gz",
"Django-1.10.1-py2.py3-none-any.whl",
],
"celery": [
"celery-4.2.0-py2.py3-none-any.whl",
"celery-4.1.1-py2.py3-none-any.whl",
],
}
PYTHON_SM_FIXTURE_CHECKSUMS = {
"aiohttp-3.3.0.tar.gz": "3128d3ef7b575dbb272cdacd4d4c9a7cf67b18899e96260d55ae3a5782d886e7",
"aiohttp-3.2.1.tar.gz": "1b95d53f8dac13898f0a3e4af76f6f36d540fbfaefc4f4c9f43e436fa0e53d22",
"aiohttp-3.2.0.tar.gz": "1be3903fe6a36d20492e74efb326522dd4702bf32b45ffc7acbc0fb34ab240a6",
"Django-1.10.4.tar.gz": "fff7f062e510d812badde7cfc57745b7779edb4d209b2bc5ea8d954c22305c2b",
"Django-1.10.4-py2.py3-none-any.whl": "a8e1a552205cda15023c39ecf17f7e525e96c5b0142e7879e8bd0c445351f2cc", # noqa: E501
"Django-1.10.3.tar.gz": "6f92f08dee8a1bd7680e098a91bf5acd08b5cdfe74137f695b60fd79f4478c30",
"Django-1.10.3-py2.py3-none-any.whl": "94426cc28d8721fbf13c333053f08d32427671a4ca7986f7030fc82bdf9c88c1", # noqa: E501
"Django-1.10.2.tar.gz": "e127f12a0bfb34843b6e8c82f91e26fff6445a7ca91d222c0794174cf97cbce1",
"Django-1.10.2-py2.py3-none-any.whl": "4d48ab8e84a7c8b2bc4b2f4f199bc3a8bfcc9cbdbc29e355ac5c44a501d73a1a", # noqa: E501
"Django-1.10.1.tar.gz": "d6e6c5b25cb67f46afd7c82f536529b11981183423dad8932e15bce93d1a24f3",
"Django-1.10.1-py2.py3-none-any.whl": "3d689905cd0635bbb33b87f9a5df7ca70a3db206faae4ec58cda5e7f5f47050d", # noqa: E501
"celery-4.2.0-py2.py3-none-any.whl": "2082cbd82effa8ac8a8a58977d70bb203a9f362817e3b66f4578117b9f93d8a9", # noqa: E501
"celery-4.1.1-py2.py3-none-any.whl": "6fc4678d1692af97e137b2a9f1c04efd8e7e2fb7134c5c5ad60738cdd927762f", # noqa: E501
}
PYTHON_MD_PROJECT_SPECIFIER = [
"shelf-reader", # matches 2
"aiohttp>=3.2.0,<3.3.1", # matches 3
"celery~=4.0", # matches 5
"Django>1.10.0,<=2.0.6", # matches 16
]
PYTHON_MD_PACKAGE_COUNT = 26
PYTHON_MD_FIXTURE_SUMMARY = {PYTHON_CONTENT_NAME: PYTHON_MD_PACKAGE_COUNT}
PYTHON_MD_PYPI_SUMMARY = {"projects": 4, "releases": 17, "files": 26}
PYTHON_LG_PROJECT_SPECIFIER = [
"aiohttp", # matches 7
"bcrypt", # matches 8
"celery", # matches 13
"crane", # matches 0
"Django", # matches 31
"pulp-2to3-migration", # matches 2
"pytz", # matches 6
"scipy", # matches 23
"setuptools", # matches 2
"shelf-reader", # matches 2
"twine", # matches 14
]
PYTHON_LG_PACKAGE_COUNT = 108
PYTHON_LG_FIXTURE_SUMMARY = {PYTHON_CONTENT_NAME: PYTHON_LG_PACKAGE_COUNT}
PYTHON_LG_FIXTURE_COUNTS = {
"latest_3": 59,
"sdist": 36,
"bdist_wheel": 72,
"multi": 36, # keep_latest=1, package_types="bdist_wheel", prereleases=False
}
DJANGO_LATEST_3 = 4 # latest version has 2 dists, each other has 1
SCIPY_COUNTS = {
"total": 23, # scipy has 23 different release files for the same release
"windows": 8,
"macos": 4,
"linux": 10,
"no_os": 1,
}
# Intended to be used with the XS specifier
PYTHON_EGG_FILENAME = "shelf-reader-0.1.tar.gz"
PYTHON_EGG_URL = urljoin(urljoin(PYTHON_FIXTURES_URL, "packages/"), PYTHON_EGG_FILENAME)
PYTHON_EGG_SHA256 = "04cfd8bb4f843e35d51bfdef2035109bdea831b55a57c3e6a154d14be116398c"
# Intended to be used with the XS specifier
PYTHON_WHEEL_FILENAME = "shelf_reader-0.1-py2-none-any.whl"
PYTHON_WHEEL_URL = urljoin(urljoin(PYTHON_FIXTURES_URL, "packages/"), PYTHON_WHEEL_FILENAME)
PYTHON_WHEEL_SHA256 = "2eceb1643c10c5e4a65970baf63bde43b79cbdac7de81dae853ce47ab05197e9"
PYTHON_WHEEL_METADATA_SHA256 = "ed333f0db05d77e933a157b7225b403ada9a2f93318d77b41b662eba78bac350"
PYTHON_XS_FIXTURE_CHECKSUMS = {
PYTHON_EGG_FILENAME: PYTHON_EGG_SHA256,
PYTHON_WHEEL_FILENAME: PYTHON_WHEEL_SHA256,
}
PYTHON_FIXTURES_PACKAGES = [
"shelf-reader",
]
PYTHON_FIXTURES_FILENAMES = [
"shelf-reader-0.1.tar.gz",
]
PYTHON_LIST_PROJECT_SPECIFIER = [
"shelf-reader",
]
# Package Data for shelf-reader
PYTHON_PACKAGE_DATA = {
"filename": "shelf-reader-0.1.tar.gz",
"packagetype": "sdist",
"name": "shelf-reader",
"version": "0.1",
"metadata_version": "1.1",
"summary": "Make sure your collections are in call number order.",
"keywords": "",
"home_page": "https://github.com/asmacdo/shelf-reader",
"download_url": "",
"author": "Austin Macdonald",
"author_email": "[email protected]",
"maintainer": "",
"maintainer_email": "",
"license": "GNU GENERAL PUBLIC LICENSE Version 2, June 1991",
"requires_python": "",
"project_url": "",
"platform": "",
"supported_platform": "",
"requires_dist": "[]",
"provides_dist": "[]",
"obsoletes_dist": "[]",
"requires_external": "[]",
"classifiers": "[]",
}
# Info data for Shelf-reader, Not all the fields are the same whether uploaded or synced :(
# pkginfo filters out 'UNKNOWN' values & fails to find a couple others due to package description
PYTHON_INFO_DATA = {
"name": "shelf-reader",
"version": "0.1",
# "metadata_version": "", # Maybe program "1.1" into parse_metadata of app/utils.py
"summary": "Make sure your collections are in call number order.",
# "keywords": "library barcode call number shelf collection",
"home_page": "https://github.com/asmacdo/shelf-reader",
# "download_url": "UNKNOWN",
"author": "Austin Macdonald",
"author_email": "[email protected]",
"maintainer": "",
"maintainer_email": "",
# "license": "GNU GENERAL PUBLIC LICENSE Version 2, June 1991",
"requires_python": None,
# "project_url": "https://pypi.org/project/shelf-reader/",
# "platform": "UNKNOWN",
# "supported_platform": None,
"requires_dist": None,
# "provides_dist": [],
# "obsoletes_dist": [],
# "requires_external": [],
# "classifiers": ['Development Status :: 4 - Beta', 'Environment :: Console',
# 'Intended Audience :: Developers',
# 'License :: OSI Approved :: GNU General Public License v2 (GPLv2)',
# 'Natural Language :: English', 'Programming Language :: Python :: 2',
# 'Programming Language :: Python :: 2.7'],
"downloads": {"last_day": -1, "last_month": -1, "last_week": -1},
# maybe add description, license is long for this one
}
# twine pkg data for PyPI Simple API
TWINE_EGG_FILENAME = "twine-5.1.0.tar.gz"
TWINE_EGG_URL = urljoin(urljoin(PYTHON_FIXTURES_URL, "packages/"), TWINE_EGG_FILENAME)
TWINE_EGG_SHA256 = "4d74770c88c4fcaf8134d2a6a9d863e40f08255ff7d8e2acb3cbbd57d25f6e9d"
TWINE_EGG_SIZE = 224997
TWINE_EGG_REQUIRES_PYTHON = ">=3.8"
TWINE_WHEEL_FILENAME = "twine-5.1.0-py3-none-any.whl"
TWINE_WHEEL_URL = urljoin(urljoin(PYTHON_FIXTURES_URL, "packages/"), TWINE_WHEEL_FILENAME)
TWINE_WHEEL_SHA256 = "fe1d814395bfe50cfbe27783cb74efe93abeac3f66deaeb6c8390e4e92bacb43"
TWINE_WHEEL_SIZE = 38563
TWINE_WHEEL_REQUIRES_PYTHON = ">=3.8"
TWINE_WHEEL_METADATA_SHA256 = "0ac5cf457bd47512b3477949ff6274cc2258414f3e1f136e049585aac92e4ddb"
TWINE_FIXTURE_CHECKSUMS = {
TWINE_EGG_FILENAME: TWINE_EGG_SHA256,
TWINE_WHEEL_FILENAME: TWINE_WHEEL_SHA256,
}
TWINE_FIXTURE_METADATA_SHA256 = {
TWINE_WHEEL_FILENAME: TWINE_WHEEL_METADATA_SHA256,
TWINE_EGG_FILENAME: None, # egg files should not have metadata
}
TWINE_FIXTURE_REQUIRES_PYTHON = {
TWINE_WHEEL_FILENAME: TWINE_EGG_REQUIRES_PYTHON,
TWINE_EGG_FILENAME: TWINE_WHEEL_REQUIRES_PYTHON,
}
# Current tests use PYTHON_FIXTURES_URL with an 'S', remove after adding api tests
PYTHON_FIXTURE_URL = urljoin(PULP_FIXTURES_BASE_URL, "python-pypi/")
"""The URL to a python repository."""
PYTHON_FIXTURE_COUNT = 2
"""The number of content units available at :data:`PYTHON_FIXTURE_URL`."""
PYTHON_FIXTURE_SUMMARY = {PYTHON_CONTENT_NAME: PYTHON_FIXTURE_COUNT}
"""The desired content summary after syncing :data:`PYTHON_FIXTURE_URL`."""
PYTHON_URL = urljoin(urljoin(PYTHON_FIXTURE_URL, "packages/"), PYTHON_EGG_FILENAME)
"""The URL to an python file at :data:`PYTHON_FIXTURE_URL`."""
# FIXME: replace this with your own fixture repository URL and metadata
PYTHON_INVALID_FIXTURE_URL = urljoin(PULP_FIXTURES_BASE_URL, "python-invalid/")
"""The URL to an invalid python repository."""
# FIXME: replace this with your own fixture repository URL and metadata
PYTHON_LARGE_FIXTURE_URL = urljoin(PULP_FIXTURES_BASE_URL, "python_large/")
"""The URL to a python repository containing a large number of content units."""
# FIXME: replace this with the actual number of content units in your test fixture
PYTHON_LARGE_FIXTURE_COUNT = 25
"""The number of content units available at :data:`PYTHON_LARGE_FIXTURE_URL`."""
DEFAULT_BANDER_REMOTE_BODY = {
"url": "https://pypi.org",
"download_concurrency": 3,
"policy": "on_demand",
"prereleases": False,
"excludes": ["example1", "example2"],
}
BANDERSNATCH_CONF = b"""
[mirror]
; The directory where the mirror data will be stored.
directory = /srv/pypi
; Save JSON metadata into the web tree:
json = false
; scheme for PyPI server MUST be https
master = https://pypi.org
; The network socket timeout to use for all connections.
timeout = 10
global-timeout = 18000
; Number of worker threads to use for parallel downloads.
workers = 3
; Whether to hash package indexes
hash-index = false
; Whether to stop a sync quickly after an error is found or whether to continue
; syncing but not marking the sync as successful.
stop-on-error = false
storage-backend = filesystem
; Number of consumers which verify metadata
verifiers = 3
; Configure a file to write out the list of files downloaded during the mirror.
diff-file = {{mirror_directory}}/mirrored-files
diff-append-epoch = false
; Enable filtering plugins
[plugins]
; Enable all or specific plugins - e.g. allowlist_project
enabled = all
[blocklist]
; List of PyPI packages not to sync - Useful if malicious packages are mirrored
packages =
example1
example2
"""
SHELF_BDIST_PYTHON_DOWNLOAD = {
"comment_text": "",
"digests": {
# "md5": "69b867d206f1ff984651aeef25fc54f9",
"sha256": "2eceb1643c10c5e4a65970baf63bde43b79cbdac7de81dae853ce47ab05197e9"
},
"downloads": -1,
"filename": "shelf_reader-0.1-py2-none-any.whl",
"has_sig": False,
# "md5_digest": "69b867d206f1ff984651aeef25fc54f9",
"packagetype": "bdist_wheel",
"python_version": "2.7",
"requires_python": None,
"size": 22455,
"yanked": False,
"yanked_reason": None,
}
SHELF_SDIST_PYTHON_DOWNLOAD = {
"comment_text": "",
"digests": {
# "md5": "2dac570a33d88ca224be86759be59376",
"sha256": "04cfd8bb4f843e35d51bfdef2035109bdea831b55a57c3e6a154d14be116398c"
},
"downloads": -1,
"filename": "shelf-reader-0.1.tar.gz",
"has_sig": False,
# "md5_digest": "2dac570a33d88ca224be86759be59376",
"packagetype": "sdist",
# "python_version": "source", # This is the correct value, but hard to generate
"requires_python": None,
"size": 19097,
"yanked": False,
"yanked_reason": None,
}
SHELF_0DOT1_RELEASE = [SHELF_BDIST_PYTHON_DOWNLOAD, SHELF_SDIST_PYTHON_DOWNLOAD]
SHELF_PYTHON_JSON = {
"info": PYTHON_INFO_DATA,
"last_serial": 0,
"releases": {"0.1": SHELF_0DOT1_RELEASE},
"urls": SHELF_0DOT1_RELEASE,
}
VULNERABILITY_REPORT_TEST_PACKAGE_NAME = "Django"
VULNERABILITY_REPORT_TEST_PACKAGES = [
"django==5.2.1",
]
PYPI_SERIAL_CONSTANT = 1000000000