Merge lp:~cjwatson/loggerhead/modernize-setup into lp:loggerhead

Proposed by Colin Watson
Status: Merged
Approved by: Jelmer Vernooij
Approved revision: 529
Merge reported by: Otto Co-Pilot
Merged at revision: not available
Proposed branch: lp:~cjwatson/loggerhead/modernize-setup
Merge into: lp:loggerhead
Prerequisite: lp:~cjwatson/loggerhead/chameleon
Diff against target: 266 lines (+111/-69)
7 files modified
NEWS (+7/-0)
__init__.py (+11/-1)
docs/conf.py (+3/-3)
docs/index.rst (+11/-7)
loggerhead/__init__.py (+12/-15)
setup.cfg (+66/-0)
setup.py (+1/-43)
To merge this branch: bzr merge lp:~cjwatson/loggerhead/modernize-setup
Reviewer Review Type Date Requested Status
Jelmer Vernooij Approve
Review via email: mp+428047@code.launchpad.net

Commit message

Modernize packaging.

Description of the change

There are new dependencies on `importlib_metadata` (for Python < 3.8) and `packaging`, in order to avoid a self-import in `setup.py`. People proxying Loggerhead through Apache should install the `loggerhead[proxied]` extra; people running it via FastCGI, SCGI, or AJP should install the `loggerhead[flup]` extra.

The version handling rearrangements make it possible to install Loggerhead using `pip`.

To post a comment you must log in.
Revision history for this message
Jelmer Vernooij (jelmer) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'NEWS'
--- NEWS 2022-08-08 17:28:36 +0000
+++ NEWS 2022-08-08 17:28:36 +0000
@@ -18,6 +18,13 @@
1818
19 - Port from SimpleTAL to Chameleon. (Colin Watson)19 - Port from SimpleTAL to Chameleon. (Colin Watson)
2020
21 - Modernize packaging. There are new dependencies on
22 ``importlib_metadata`` (for Python < 3.8) and ``packaging``, in order
23 to avoid a self-import in ``setup.py``. People proxying Loggerhead
24 through Apache should install the ``loggerhead[proxied]`` extra;
25 people running it via FastCGI, SCGI, or AJP should install the
26 ``loggerhead[flup]`` extra. (Colin Watson, #1831661)
27
211.20.0 [18Jul2021]281.20.0 [18Jul2021]
22------------------29------------------
2330
2431
=== modified file '__init__.py'
--- __init__.py 2018-11-03 18:15:51 +0000
+++ __init__.py 2022-08-08 17:28:36 +0000
@@ -30,9 +30,19 @@
30starts a web server to browse the contents of a branch.30starts a web server to browse the contents of a branch.
31"""31"""
3232
33try:
34 import importlib.metadata as importlib_metadata
35except ImportError:
36 import importlib_metadata
33import sys37import sys
3438
35version_info = (1, 20, 0) # Keep in sync with loggerhead/__init__.py39from packaging.version import Version
40
41try:
42 version_info = Version(importlib_metadata.version("loggerhead")).release
43except importlib_metadata.PackageNotFoundError:
44 # Support running tests from the build tree without installation.
45 version_info = None
3646
37import breezy47import breezy
38from breezy import commands48from breezy import commands
3949
=== modified file 'docs/conf.py'
--- docs/conf.py 2010-03-25 10:25:13 +0000
+++ docs/conf.py 2022-08-08 17:28:36 +0000
@@ -11,7 +11,7 @@
11# All configuration values have a default; values that are commented out11# All configuration values have a default; values that are commented out
12# serve to show the default.12# serve to show the default.
1313
14import sys, os14from loggerhead import __version__
1515
16# If extensions (or modules to document with autodoc) are in another directory,16# If extensions (or modules to document with autodoc) are in another directory,
17# add these directories to sys.path here. If the directory is relative to the17# add these directories to sys.path here. If the directory is relative to the
@@ -45,9 +45,9 @@
45# built documents.45# built documents.
46#46#
47# The short X.Y version.47# The short X.Y version.
48version = '1.17'48version = __version__
49# The full version, including alpha/beta/rc tags.49# The full version, including alpha/beta/rc tags.
50release = '1.17'50release = __version__
5151
52# The language for content autogenerated by Sphinx. Refer to documentation52# The language for content autogenerated by Sphinx. Refer to documentation
53# for a list of supported languages.53# for a list of supported languages.
5454
=== modified file 'docs/index.rst'
--- docs/index.rst 2022-08-08 17:28:36 +0000
+++ docs/index.rst 2022-08-08 17:28:36 +0000
@@ -17,7 +17,7 @@
1717
18- Paste for the server. (You need version 1.2 or newer of Paste).18- Paste for the server. (You need version 1.2 or newer of Paste).
1919
20- Paste Deploy (optional, needed when proxying through Apache).20- PasteDeploy (optional, needed when proxying through Apache).
2121
22- flup (optional, needed to use FastCGI, SCGI or AJP).22- flup (optional, needed to use FastCGI, SCGI or AJP).
2323
@@ -32,15 +32,19 @@
32 $ sudo apt-get install python-pastedeploy32 $ sudo apt-get install python-pastedeploy
33 $ sudo apt-get install python-flup33 $ sudo apt-get install python-flup
3434
35Installing Dependencies Using :command:`easy_install`35Installing Dependencies Using :command:`pip`
36#####################################################36############################################
37
38You should normally create and activate a virtual environment first.
3739
38.. code-block:: sh40.. code-block:: sh
3941
40 $ easy_install Chameleon42 # Basic installation only
41 $ easy_install Paste43 $ pip install loggerhead
42 $ easy_install PasteDeploy44 # Installation for proxying through Apache
43 $ easy_install flup45 $ pip install 'loggerhead[proxied]'
46 # Installation for FastCGI, SCGI or AJP
47 $ pip install 'loggerhead[flup]'
4448
4549
46Running the Standalone Loggerhead Server50Running the Standalone Loggerhead Server
4751
=== modified file 'loggerhead/__init__.py'
--- loggerhead/__init__.py 2021-11-15 14:40:11 +0000
+++ loggerhead/__init__.py 2022-08-08 17:28:36 +0000
@@ -15,20 +15,17 @@
15# along with this program; if not, write to the Free Software15# along with this program; if not, write to the Free Software
16# Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA16# Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
1717
18"""A simple container to turn this into a python package.18"""A simple container to turn this into a python package."""
1919
20We also check the versions of some dependencies.20try:
21"""21 import importlib.metadata as importlib_metadata
2222except ImportError:
23import pkg_resources23 import importlib_metadata
2424
25__version__ = '1.20.0' # Keep in sync with ../__init__.py.25try:
26 __version__ = importlib_metadata.version("loggerhead")
27except importlib_metadata.PackageNotFoundError:
28 # Support running tests from the build tree without installation.
29 __version__ = None
26__revision__ = None30__revision__ = None
27required_breezy = (3, 1)31required_breezy = (3, 1)
28
29pkg_resources.get_distribution('Paste>=1.6')
30try:
31 pkg_resources.get_distribution('PasteDeploy>=1.3')
32except pkg_resources.DistributionNotFound:
33 # No paste.deploy is OK, but an old paste.deploy is bad.
34 pass
3532
=== added file 'setup.cfg'
--- setup.cfg 1970-01-01 00:00:00 +0000
+++ setup.cfg 2022-08-08 17:28:36 +0000
@@ -0,0 +1,66 @@
1# Copyright (C) 2008-2022 Canonical Ltd.
2#
3# This program is free software; you can redistribute it and/or modify
4# it under the terms of the GNU General Public License as published by
5# the Free Software Foundation; either version 2 of the License, or
6# (at your option) any later version.
7#
8# This program is distributed in the hope that it will be useful,
9# but WITHOUT ANY WARRANTY; without even the implied warranty of
10# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11# GNU General Public License for more details.
12#
13# You should have received a copy of the GNU General Public License
14# along with this program; if not, write to the Free Software
15# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16
17[metadata]
18name = loggerhead
19version = 2.0.0.dev0
20description = Loggerhead is a web viewer for projects in bazaar
21long_description = file: README.rst
22long_description_content_type = text/x-rst
23license = GNU GPL v2 or later
24maintainer = Michael Hudson
25maintainer_email = michael.hudson@canonical.com
26
27[options]
28scripts =
29 loggerhead-serve
30packages =
31 breezy.plugins.loggerhead
32 loggerhead
33 loggerhead.apps
34 loggerhead.controllers
35 loggerhead.middleware
36 loggerhead.templates
37package_dir =
38 breezy.plugins.loggerhead=.
39install_requires =
40 Chameleon
41 Paste>=1.6
42 bleach
43 breezy>=3.1
44 importlib-metadata; python_version < "3.8"
45 packaging
46
47[options.data_files]
48share/man/man1 =
49 loggerhead-serve.1
50share/doc/loggerhead =
51 apache-loggerhead.conf
52 breezy.conf
53 loggerheadd
54
55[options.extras_require]
56proxied =
57 PasteDeploy>=1.3
58flup =
59 flup
60
61[options.package_data]
62loggerhead =
63 static/css/*.css
64 static/images/*
65 static/javascript/*.js
66 templates/*.pt
067
=== modified file 'setup.py'
--- setup.py 2022-02-23 19:28:51 +0000
+++ setup.py 2022-08-08 17:28:36 +0000
@@ -20,46 +20,4 @@
2020
21from setuptools import setup21from setuptools import setup
2222
23import loggerhead23setup()
24
25
26with open("README.rst") as readme:
27 long_description = readme.read()
28
29
30setup(
31 name="loggerhead",
32 version=loggerhead.__version__,
33 description="Loggerhead is a web viewer for projects in bazaar",
34 long_description=long_description,
35 long_description_content_type="text/x-rst",
36 license="GNU GPL v2 or later",
37 maintainer="Michael Hudson",
38 maintainer_email="michael.hudson@canonical.com",
39 scripts=[
40 "loggerhead-serve",
41 ],
42 packages=["loggerhead",
43 "loggerhead/apps",
44 "loggerhead/controllers",
45 "loggerhead/middleware",
46 "loggerhead/templates",
47 "breezy.plugins.loggerhead"],
48 package_dir={'breezy.plugins.loggerhead': '.'},
49 package_data={"loggerhead": ["templates/*.pt",
50 "static/css/*.css",
51 "static/javascript/*.js",
52 "static/images/*"]},
53 data_files=[
54 ('share/man/man1', ['loggerhead-serve.1']),
55 ('share/doc/loggerhead', ['apache-loggerhead.conf',
56 'loggerheadd',
57 'breezy.conf']),
58 ],
59 install_requires=[
60 'paste',
61 'bleach',
62 'breezy>=3.1',
63 ],
64 testsuite='loggerhead.tests.test_suite',
65 )

Subscribers

People subscribed via source and target branches