Skip to content

Commit 642b77d

Browse files
committed
Fixed merge issue with requirements. The git link appears broken, using pypi instead
2 parents ad3b182 + 2ff4375 commit 642b77d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+1561
-770
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ collected_static/
1212
testing/
1313
env/
1414
htmlcov
15+
*.tar.gz
1516

1617
.mypy_cache/
1718

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,6 @@ gpg --sender "User Name <[email protected]>" --detach-sign sitestatic/netboot/*.
154154

155155
# Production Installation
156156

157-
Arch Linux has an Ansible role for Archweb in their [infrastructure repo](https://git.archlinux.org/infrastructure.git/).
157+
Arch Linux has an Ansible role for Archweb in their [infrastructure repo](https://gitlab.archlinux.org/archlinux/infrastructure).
158158

159159
vim: set syntax=markdown et:

devel/forms.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from django.contrib.sites.models import Site
88
from django.core.mail import send_mail
99
from django.template import loader
10+
from django.forms.widgets import EmailInput, NumberInput, URLInput
1011

1112
from .models import UserProfile
1213

@@ -41,6 +42,12 @@ def clean_pgp_key(self):
4142
class Meta:
4243
model = UserProfile
4344
exclude = ('allowed_repos', 'user', 'repos_auth_token')
45+
widgets = {
46+
'yob': NumberInput(attrs={'min': 1950, 'max': 2500}),
47+
'public_email': EmailInput(), # HACK: field definition should be fixed
48+
'website': URLInput(),
49+
'website_rss': URLInput(),
50+
}
4451

4552

4653
class NewUserForm(forms.ModelForm):

devel/management/commands/pgp_import.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,8 @@
88
"""
99

1010
from collections import OrderedDict
11-
from datetime import datetime
11+
from datetime import datetime, timezone
1212
import logging
13-
from pytz import utc
1413
import subprocess
1514

1615
from django.core.management.base import BaseCommand, CommandError
@@ -50,14 +49,14 @@ def get_date(epoch_string):
5049
'''Convert a epoch string into a python 'date' object (not datetime).'''
5150
if not epoch_string:
5251
return None
53-
return datetime.utcfromtimestamp(int(epoch_string)).date()
52+
return datetime.fromtimestamp(int(epoch_string), tz=timezone.utc).date()
5453

5554

5655
def get_datetime(epoch_string):
5756
'''Convert a epoch string into a python 'datetime' object.'''
5857
if not epoch_string:
5958
return None
60-
return datetime.utcfromtimestamp(int(epoch_string)).replace(tzinfo=utc)
59+
return datetime.fromtimestamp(int(epoch_string), tz=timezone.utc)
6160

6261

6362
def call_gpg(keyring, *args):

devel/management/commands/reporead.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@
2121
import re
2222
import xtarfile as tarfile
2323
import logging
24-
from datetime import datetime
25-
from pytz import utc
24+
from datetime import datetime, timezone
2625

2726
from django.core.management.base import BaseCommand, CommandError
2827
from django.db import connections, router, transaction
@@ -120,8 +119,7 @@ def populate(self, values):
120119
self.ver, self.rel, self.epoch = parse_version(v[0])
121120
elif k == 'builddate':
122121
try:
123-
builddate = datetime.utcfromtimestamp(int(v[0]))
124-
self.builddate = builddate.replace(tzinfo=utc)
122+
self.builddate = datetime.fromtimestamp(int(v[0]), tz=timezone.utc)
125123
except ValueError:
126124
logger.warning(
127125
'Package %s had unparsable build date %s',

devel/migrations/0008_alter_userprofile_repos_auth_token_and_more.py

Lines changed: 23 additions & 0 deletions
Large diffs are not rendered by default.

devel/migrations/0009_alter_userprofile_time_zone_alter_userprofile_yob.py

Lines changed: 647 additions & 0 deletions
Large diffs are not rendered by default.

devel/models.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
# -*- coding: utf-8 -*-
2-
import pytz
2+
import zoneinfo
33

44
from django.urls import reverse
55
from django.db import models
66
from django.db.models.signals import pre_save, post_save
77
from django.contrib.auth.models import User, Group
88
from django_countries.fields import CountryField
9+
from django.core.validators import MinValueValidator, MaxValueValidator
910

1011
from .fields import PGPKeyField
1112
from main.utils import make_choice, set_created_field
@@ -22,7 +23,7 @@ class UserProfile(models.Model):
2223
help_text="When enabled, send user 'flag out-of-date' notifications")
2324
time_zone = models.CharField(
2425
max_length=100,
25-
choices=make_choice(pytz.common_timezones),
26+
choices=make_choice(sorted(zoneinfo.available_timezones())), # sort as available_timezones output varies
2627
default="UTC",
2728
help_text="Used for developer clock page")
2829
alias = models.CharField(
@@ -39,7 +40,8 @@ class UserProfile(models.Model):
3940
website = models.CharField(max_length=200, null=True, blank=True)
4041
website_rss = models.CharField(max_length=200, null=True, blank=True,
4142
help_text='RSS Feed of your website for planet.archlinux.org')
42-
yob = models.IntegerField("Year of birth", null=True, blank=True)
43+
yob = models.IntegerField("Year of birth", null=True, blank=True,
44+
validators=[MinValueValidator(1950), MaxValueValidator(2500)])
4345
country = CountryField(blank=True)
4446
location = models.CharField(max_length=50, null=True, blank=True)
4547
languages = models.CharField(max_length=50, null=True, blank=True)

devel/reports.py

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
from collections import defaultdict
2-
from datetime import timedelta
2+
from datetime import timedelta, timezone
33

4-
import pytz
54
from django.db.models import F
65
from django.template.defaultfilters import filesizeformat
76
from django.db import connection
@@ -171,7 +170,7 @@ def signature_time(packages):
171170
'arch', 'repo', 'packager').filter(signature_bytes__isnull=False)
172171
for package in packages:
173172
sig = package.signature
174-
sig_date = sig.creation_time.replace(tzinfo=pytz.utc)
173+
sig_date = sig.creation_time.replace(tzinfo=timezone.utc)
175174
package.sig_date = sig_date.date()
176175
if sig_date > package.build_date + cutoff:
177176
filtered.append(package)
@@ -244,11 +243,6 @@ def orphan_dependencies(packages):
244243
return pkgs
245244

246245

247-
def unused_python2_packages(packages):
248-
required = Depend.objects.all().values('name')
249-
return packages.filter(pkgname__startswith='python2').exclude(pkgname__in=required)
250-
251-
252246
REPORT_OLD = DeveloperReport(
253247
'old', 'Old', 'Packages last built more than two years ago', old)
254248

@@ -328,13 +322,6 @@ def unused_python2_packages(packages):
328322
['Orphan dependencies'],
329323
['orphandeps'])
330324

331-
UNUSED_PYTHON2_PACKAGES = DeveloperReport(
332-
'unused-python2',
333-
'Unused Python2 packages',
334-
'python2 modules which are not used required by any other packages in the repository',
335-
unused_python2_packages,
336-
personal=False)
337-
338325

339326
def available_reports():
340327
return (REPORT_OLD,
@@ -349,5 +336,4 @@ def available_reports():
349336
REPORT_SIG_TIME,
350337
NON_EXISTING_DEPENDENCIES,
351338
REBUILDERD_PACKAGES,
352-
ORPHAN_REBUILDERD_PACKAGES,
353-
UNUSED_PYTHON2_PACKAGES)
339+
ORPHAN_REBUILDERD_PACKAGES)

devel/tests/test_reporead.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
import tarfile
22
from unittest.mock import patch
3-
from datetime import datetime
3+
from datetime import datetime, timezone
44

55

66
from django.core.management import call_command
77
from django.core.management.base import CommandError
88
from django.test import TransactionTestCase
9-
from django.utils import timezone
109

1110

1211
from main.models import Arch, Package, Repo

0 commit comments

Comments
 (0)