Skip to content

Commit 167e883

Browse files
committed
python 3 / django 2.2 support
1 parent 4c053b1 commit 167e883

Some content is hidden

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

89 files changed

+235
-383
lines changed

.github/workflows/create-release-and-upload-assets.yml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ jobs:
5050
git config user.name 'Marcus Furlong'
5151
- name: Install dependencies
5252
run: |
53-
sudo apt -y install python-setuptools debhelper dh-exec dh-python git-buildpackage
53+
sudo apt -y install python3-setuptools debhelper dh-exec dh-python git-buildpackage
5454
- name: Update repo version if required
5555
env:
5656
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -143,14 +143,12 @@ jobs:
143143
needs: update-version-and-changelog
144144
runs-on: ubuntu-latest
145145
container:
146-
image: centos:7
146+
image: centos:8
147147
steps:
148148
- name: Install build dependencies
149149
run: |
150-
yum -y install epel-release
151-
yum -y install https://repo.ius.io/ius-release-el7.rpm
152-
yum makecache
153-
yum -y install rpm-build python-setuptools git222
150+
dnf -y install epel-release
151+
dnf -y install rpm-build python-setuptools git
154152
- uses: actions/checkout@v2
155153
with:
156154
fetch-depth: 0

.github/workflows/lint-and-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
strategy:
99
max-parallel: 4
1010
matrix:
11-
python-version: [2.7]
11+
python-version: [3.6, 3.7, 3.8]
1212
steps:
1313
- uses: actions/checkout@v1
1414
- name: Set up Python ${{ matrix.python-version }}

INSTALL.md

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,20 @@ mysql or postgresql instead, see the database configuration section.
55

66

77
## Supported Install Options
8-
- [Ubuntu 18.04](#ubuntu-1804-bionic)
8+
- [Ubuntu 20.04](#ubuntu-2004-bionic)
99
- [Debian 10](#debian-10-buster)
1010
- [CentOS 7](#centos-7)
1111
- [virtualenv + pip](#virtualenv--pip)
1212
- [Source](#source)
1313

1414

15-
### Ubuntu 18.04 (bionic)
15+
### Ubuntu 20.04 (focal)
1616

1717
```shell
1818
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 0412F522
19-
echo "deb https://repo.openbytes.ie/ubuntu bionic main" > /etc/apt/sources.list.d/patchman.list
19+
echo "deb https://repo.openbytes.ie/ubuntu focal main" > /etc/apt/sources.list.d/patchman.list
2020
apt update
21-
apt -y install python-patchman patchman-client
21+
apt -y install python3-patchman patchman-client
2222
patchman-manage createsuperuser
2323
```
2424

@@ -28,7 +28,8 @@ patchman-manage createsuperuser
2828
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 0412F522
2929
echo "deb https://repo.openbytes.ie/debian buster main" > /etc/apt/sources.list.d/patchman.list
3030
apt update
31-
apt -y install python-patchman patchman-client
31+
apt -t buster-backports -y install python3-django
32+
apt -y install python3-patchman patchman-client
3233
patchman-manage createsuperuser
3334
```
3435

@@ -54,8 +55,8 @@ patchman-manage createsuperuser
5455
TBD - not working yet
5556

5657
```shell
57-
apt -y install gcc libxml2-dev libxslt1-dev virtualenv python-dev zlib1g-dev # (debian/ubuntu)
58-
yum -y install gcc libxml2-devel libxslt-devel python-virtualenv # (centos/rhel)
58+
apt -y install gcc libxml2-dev libxslt1-dev virtualenv python3-dev zlib1g-dev # (debian/ubuntu)
59+
yum -y install gcc libxml2-devel libxslt-devel python3-virtualenv # (centos/rhel)
5960
mkdir /srv/patchman
6061
cd /srv/patchman
6162
virtualenv .
@@ -74,17 +75,18 @@ gunicorn patchman.wsgi -b 0.0.0.0:80
7475
1. Install dependencies
7576

7677
```shell
77-
apt -y install python-django-tagging python-django python-requests \
78-
python-django-extensions python-argparse python-defusedxml python-rpm python-debian \
79-
python-pygooglechart python-cracklib python-progressbar libapache2-mod-wsgi \
80-
python-djangorestframework apache2 python-colorama python-humanize liblzma-dev \
81-
python-magic python-lxml
78+
apt -y install -t buster-backports python3-django
79+
apt -y install python3-django-tagging python3-django-extensions
80+
python3-djangorestframework python3-defusedxml python3-lxml \
81+
python3-requests python3-rpm python3-debian \
82+
python3-colorama python3-humanize python3-magic \
83+
apache2 libapache2-mod-wsgi
8284
```
8385

8486
2. Install django-bootstrap3
8587

8688
```shell
87-
pip install django-bootstrap3
89+
pip3 install django-bootstrap3
8890
```
8991

9092
3. Clone git repo to e.g. /srv/patchman
@@ -152,7 +154,7 @@ To configure the mysql database backend:
152154
1. Ensure mysql-server and the python mysql bindings are installed:
153155

154156
```shell
155-
apt -y install default-mysql-server python-mysqldb python-pymysql
157+
apt -y install default-mysql-server python3-mysqldb
156158
```
157159

158160
2. Create database and users:
@@ -193,7 +195,7 @@ To configure the postgresql database backend:
193195
1. Ensure the postgresql server and the python postgres bindings are installed:
194196

195197
```shell
196-
apt -y install postgresql python-psycopg2
198+
apt -y install postgresql python3-psycopg2
197199
```
198200

199201
2. Create database and users:
@@ -311,14 +313,14 @@ Install Celery for realtime processing of reports from clients:
311313
#### Ubuntu / Debian
312314

313315
```shell
314-
apt -y install python-celery python-celery-common rabbitmq-server
316+
apt -y install python3-celery rabbitmq-server
315317
C_FORCE_ROOT=1 celery worker --loglevel=info -E -A patchman
316318
```
317319

318320
#### CentOS / RHEL
319321

320322
```shell
321-
yum -y install python-celery rabbitmq-server
323+
yum -y install python3-celery rabbitmq-server
322324
systemctl restart rabbitmq-server
323325
semanage port -a -t http_port_t -p tcp 5672
324326
C_FORCE_ROOT=1 celery worker --loglevel=info -E -A patchman
@@ -333,8 +335,8 @@ persistent over reboot.
333335
Memcached can optionally be run to reduce the load on the server.
334336

335337
```shell
336-
apt -y install memcached python-memcache # (debian/ubuntu)
337-
yum -y install memcached python-memcached # (centos/rhel)
338+
apt -y install memcached python3-memcache # (debian/ubuntu)
339+
yum -y install memcached python3-memcached # (centos/rhel)
338340
systemctl restart memcached
339341
```
340342

README.md

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -92,19 +92,20 @@ optional arguments:
9292
9393
9494
```
95-
python-django
96-
python-django-tagging
97-
python-django-extensions
98-
python-django-bootstrap3
99-
python-djangorestframework
100-
python-debian
101-
python-rpm
102-
python-progressbar
103-
python-lxml
104-
python-defusedxml
105-
python-argparse
106-
python-requests
107-
python-humanize
95+
python3-django
96+
python3-django-tagging
97+
python3-django-extensions
98+
python3-django-bootstrap3
99+
python3-djangorestframework
100+
python3-debian
101+
python3-rpm
102+
python3-progressbar
103+
python3-lxml
104+
python3-defusedxml
105+
python3-requests
106+
python3-colorama
107+
python3-magic
108+
python3-humanize
108109
```
109110
110111
The server can optionally make use of celery to asynchronously process the

TODO

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,8 @@
77
* record the history of installed packages on a host
88
* also store package descriptions/tags/urls
99
* check for unused repos
10-
* rdns checks off by default
1110
* suggest names for repos with the same checksum
12-
* helper script to change paths (e.g. /usr/lib/python2.7/dist-packages/patchman)
13-
* process reports in background
11+
* helper script to change paths (e.g. /usr/lib/python3/dist-packages/patchman)
1412
* Dockerfile/Dockerimage
1513
* compressed reports
1614
* modularity support
17-
* add cronjobs to built packages
18-
* install celery/rabbit/memcache with packages

arch/admin.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Copyright 2012 VPAC, http://www.vpac.org
2-
# Copyright 2013-2016 Marcus Furlong <[email protected]>
2+
# Copyright 2013-2020 Marcus Furlong <[email protected]>
33
#
44
# This file is part of Patchman.
55
#
@@ -15,8 +15,6 @@
1515
# You should have received a copy of the GNU General Public License
1616
# along with Patchman. If not, see <http://www.gnu.org/licenses/>
1717

18-
from __future__ import unicode_literals
19-
2018
from django.contrib import admin
2119
from arch.models import PackageArchitecture, MachineArchitecture
2220

arch/apps.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2019 Marcus Furlong <[email protected]>
1+
# Copyright 2019-2020 Marcus Furlong <[email protected]>
22
#
33
# This file is part of Patchman.
44
#
@@ -14,8 +14,6 @@
1414
# You should have received a copy of the GNU General Public License
1515
# along with Patchman. If not, see <http://www.gnu.org/licenses/>
1616

17-
from __future__ import unicode_literals
18-
1917
from django.apps import AppConfig
2018

2119

arch/models.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Copyright 2012 VPAC, http://www.vpac.org
2-
# Copyright 2013-2016 Marcus Furlong <[email protected]>
2+
# Copyright 2013-2020 Marcus Furlong <[email protected]>
33
#
44
# This file is part of Patchman.
55
#
@@ -15,13 +15,9 @@
1515
# You should have received a copy of the GNU General Public License
1616
# along with Patchman. If not, see <http://www.gnu.org/licenses/>
1717

18-
from __future__ import unicode_literals
19-
20-
from django.utils.encoding import python_2_unicode_compatible
2118
from django.db import models
2219

2320

24-
@python_2_unicode_compatible
2521
class Architecture(models.Model):
2622

2723
name = models.CharField(unique=True, max_length=255)

arch/serializers.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2016 Marcus Furlong <[email protected]>
1+
# Copyright 2016-2020 Marcus Furlong <[email protected]>
22
#
33
# This file is part of Patchman.
44
#
@@ -14,8 +14,6 @@
1414
# You should have received a copy of the GNU General Public License
1515
# along with Patchman. If not, see <http://www.gnu.org/licenses/>
1616

17-
from __future__ import unicode_literals
18-
1917
from rest_framework import serializers
2018

2119
from arch.models import PackageArchitecture, MachineArchitecture

arch/views.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2016 Marcus Furlong <[email protected]>
1+
# Copyright 2016-2020 Marcus Furlong <[email protected]>
22
#
33
# This file is part of Patchman.
44
#
@@ -14,8 +14,6 @@
1414
# You should have received a copy of the GNU General Public License
1515
# along with Patchman. If not, see <http://www.gnu.org/licenses/>
1616

17-
from __future__ import unicode_literals
18-
1917
from rest_framework import viewsets, permissions
2018

2119
from arch.models import PackageArchitecture, MachineArchitecture

0 commit comments

Comments
 (0)