Skip to content

Commit 9363b04

Browse files
committed
Switch the packaging from Distutils to Setuptools
* Setuptools is more in line with the current trends in Python packaging, and allows us to generate built distributions in wheel format (see <#7>). * The changes in README.rst also announce the end of Python 2 support (Python upstream is about to terminate this support too, it is time people still using Python 2 switch to Python 3). * setup.py: keep the 'keywords' argument of setup() in the old format (list of strings), otherwise when building under Python 2, one gets one-letter keywords in the generated metadata! (cherry picked from commit 88a3f0b)
1 parent e1e974c commit 9363b04

File tree

6 files changed

+100
-102
lines changed

6 files changed

+100
-102
lines changed

‎.gitignore‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,9 @@ __pycache__/
66
# Automatically generated from ChangeLog.init and the Git log
77
/ChangeLog
88

9-
# Automatically generated by distutils
10-
/PKG-INFO
11-
/MANIFEST
9+
# Automatically populated by Setuptools
1210
/build/
11+
/pythondialog.egg-info/
1312

1413
# Distribution tarballs
1514
/dist/

‎INSTALL‎

Lines changed: 50 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,34 @@
11
INSTALLATION
22
============
33

4-
pythondialog is packaged with Distutils. With the current state of
4+
pythondialog is packaged with Setuptools. With the current state of
55
Python packaging and installation tools, there are several ways to
66
install the Python 2 backport of pythondialog from source.
77

8-
Probably, the easiest and cleanest method at this date (April 2015) is
9-
to use pip, possibly inside a virtual environment created with
10-
virtualenv or venv.py/pyvenv (at the time of this writing,
11-
venv.py/pyvenv is only available for Python 3). Typically, assuming you
12-
have a working pip setup (see below), you just have to run one of the
13-
following commands:
8+
Probably, the easiest and cleanest method at this date (December 2019)
9+
is to use pip, possibly inside a virtual environment created with
10+
virtualenv. Typically, assuming you have a working pip setup (see
11+
below), you just have to run one of the following commands:
1412

1513
pip install python2-pythondialog (which normally installs from PyPI)
1614

1715
or
1816

19-
pip install /path/to/python2-pythondialog-X.Y.Z.tar.gz
17+
pip install /path/to/python2_pythondialog-X.Y.Z-py2-none-any.whl
2018

2119
or
2220

23-
pip install https://url/to/python2-pythondialog-X.Y.Z.tar.gz
21+
pip install /path/to/python2-pythondialog-X.Y.Z.tar.gz
2422

2523
or
2624

27-
pip install http://url/to/python2-pythondialog-X.Y.Z.tar.gz
25+
pip install https://url/to/python2-pythondialog-X.Y.Z.tar.gz
26+
27+
etc.
2828

2929
Notes:
30-
- old versions of pip don't support https;
30+
- very old versions of pip don't support https---better upgrade pip if
31+
you have such an old version;
3132
- upgrades can be done by passing '--upgrade' or '-U' to the
3233
'pip install' command; please refer to the pip documentation for
3334
details.
@@ -83,53 +84,46 @@ desirable inside a virtual environment created with virtualenv or
8384
venv.py/pyvenv.
8485

8586

86-
Old way, without pip
87-
--------------------
88-
89-
The following instructions explain how to install the Python 2 backport
90-
of pythondialog directly from its setup.py, without using pip. If
91-
possible, the method based on pip is preferable because it makes
92-
uninstallation standard and easy.
93-
94-
Here are the steps:
95-
- make this file's directory your shell's current directory
96-
- optionally edit setup.cfg (cf. the "Installing Python Modules"
97-
chapter of the Python documentation).
87+
Older ways, without pip
88+
-----------------------
9889

99-
- a) 1) type:
90+
The installation method based on pip is much preferred because for one,
91+
it makes uninstallation standard and easy. In case you really can't use
92+
pip, the following instructions should help you install the Python 2
93+
backport of pythondialog, nevertheless. Here are two ways:
10094

101-
python2 ./setup.py build
95+
1) Because pythondialog only needs dialog.py in the proper place to
96+
work, you may simply copy this file to an appropriate directory for
97+
your Python installation (probably something like
98+
<base_dir>/lib/python2.7/site-packages). For uninstallation, simply
99+
remove the file you copied (also byte-compiled files such as
100+
dialog.pyc if such files have been created from dialog.py).
102101

103-
(depending on your system and the Python version you want to
104-
install for, you may have to replace "python2" with "python"
105-
or, for instance, "python2.7")
102+
2) Another technique can be used if you have Setuptools installed. In
103+
this case, you can run:
106104

107-
2) then, as root (after replacing /usr/local with the actual
108-
installation prefix you want to use):
105+
python2 ./setup.py build
109106

110-
python2 ./setup.py install --prefix=/usr/local \
111-
--record /path/to/foo
107+
from the root of the pythondialog distribution, followed by
112108

113-
where foo is a file of your choice which will contain the list
114-
of all files installed on your system by the preceding
115-
command. This will make uninstallation easy (you could ommit
116-
the "--record /path/to/foo", but uninstallation could not be
117-
automated, then).
109+
python2 ./setup.py install
118110

119-
OR
111+
(the second command might need root privileges, depending on where
112+
you are trying to install). This should create a file such as
113+
<base_dir>/lib/python2.7/site-packages/python2_pythondialog-3.5.1-py2.7.egg
114+
and add an entry to
115+
<base_dir>/lib/python2.7/site-packages/easy-install.pth that points
116+
to the .egg file. Uninstallation would then be done with
117+
'<base_dir>/bin/easy_install -m python2-pythondialog' followed by
118+
manual removal of the .egg file.
120119

121-
b) type, as root (after replacing the installation prefix):
122-
123-
python2 ./setup.py install --prefix=/usr/local \
124-
--record /path/to/foo
125-
126-
This will automatically build the package before installing it.
127-
The observations made in a) also apply here.
128-
129-
130-
If this default installation is not what you wish, please read the
131-
Distutils documentation which should be available in the "Installing
132-
Python Modules" chapter of the Python documentation.
120+
I repeat: the supported method is with pip, as documented earlier in
121+
this file. The tips in this section are only given to help people with
122+
uncommon constraints such as "I can't use pip". Tip 1 (copying
123+
dialog.py) is rather straightforward, no real problem. Tip 2 has been
124+
quickly tested in a virtualenv, appears to work fine but uses deprecated
125+
tools. You can use it, but will be on your own in case things don't go
126+
exactly as you expected.
133127

134128

135129
UNINSTALLATION
@@ -140,20 +134,13 @@ uninstall it with the following command:
140134

141135
pip uninstall python2-pythondialog
142136

143-
(which should be run under the same account that was used to run the
144-
"pip install" command)
145-
146-
Otherwise, if you have followed the old installation procedure, you have
147-
a /path/to/foo file that contains all the files the installation process
148-
put on your system. Great! All you have to do is:
149-
150-
while read file; do rm -f "$file"; done < /path/to/foo
151-
152-
under a POSIX-style shell and with appropriate privileges (maybe root,
153-
depending on how you installed the Python 2 backport of pythondialog).
137+
It should be run under the same account that was used to run the
138+
'pip install' command.
154139

155-
Note: this will handle file names with spaces correctly, unlike the
156-
simpler "rm -f $(cat /path/to/foo)".
140+
On the other hand, if you installed pythondialog using techniques from
141+
the previous section ("Older ways, without pip"), uninstallation
142+
instructions were given there along with each of the mentioned
143+
techniques.
157144

158145

159146
# Local Variables:

‎README.distributors‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,23 @@ Packaging from a release tarball
44
================================
55

66
Packaging from an official release tarball ("source distribution" in
7-
distutils-speak) should be fairly straightforward, as every source
7+
PyPA-speak[1]) should be fairly straightforward, as every source
88
distribution should contain a ChangeLog file that is ready to use. The rest of
99
this file mainly concerns developers and people wanting to package
1010
pythondialog from a clone of the Git repository.
1111

12+
[1] https://packaging.python.org/glossary/#term-source-distribution-or-sdist
13+
1214

1315
Management of the ChangeLog file
1416
================================
1517

1618
Starting from version 2.14.1, the ChangeLog file is not part of the Git
1719
repository anymore, because it is automatically generated from the Git log
18-
with the gitlog-to-changelog[1] program. But it must be present in every
20+
with the gitlog-to-changelog[2] program. But it must be present in every
1921
released tarball or package!
2022

21-
[1] http://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=blob_plain;f=build-aux/gitlog-to-changelog
23+
[2] https://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=blob_plain;f=build-aux/gitlog-to-changelog
2224

2325
To make this as easy as possible, setup.py does the following:
2426
- create or refresh (overwriting) ChangeLog from ChangeLog.init and the Git

‎README.rst‎

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,20 @@ WARNING
1010
This version is a backport of pythondialog to Python 2. Unless you
1111
*really* have to use Python 2, you should go to the `pythondialog home
1212
page`_ and download the reference implementation which, at the time of
13-
this writing (May 2016) and for the forseeable future, is targeted
13+
this writing (December 2019) and for the foreseeable future, is targeted
1414
at Python 3.
1515

1616
.. _pythondialog home page: http://pythondialog.sourceforge.net/
1717

1818
This version is only here to help users who are somehow forced to still
1919
use Python 2, even though Python 3.0 was released on December 3, 2008.
20-
It may be the last update for Python 2. In addition, the reference
21-
implementation is less likely to have bugs.
20+
Python 2 has `reached its end of life
21+
<https://www.python.org/doc/sunset-python-2/>`_, and so does this
22+
backport. **This backport is now unsupported. Don't expect any further
23+
updates.**
2224

23-
Before using this backport, be sure to read the `Backport-specific
24-
notes`_ below.
25+
If, despite all of these warnings, you still want to use it, be sure to
26+
read the `Backport-specific notes`_ below.
2527

2628

2729
Overview
@@ -85,8 +87,8 @@ Python library`_ looks rather interesting, too.
8587
Requirements
8688
------------
8789

88-
* This backport of pythondialog requires Python 2.6 or later in the 2.x
89-
series. It has been tested with Python 2.7.
90+
* This **now unsupported** backport of pythondialog requires Python 2.6
91+
or later in the 2.x series. It has been tested with Python 2.7.
9092

9193
* The reference implementation supports more recent versions of the
9294
Python interpreter. Please visit the `pythondialog home page`_ for
@@ -104,7 +106,7 @@ Requirements
104106
Quick installation instructions
105107
-------------------------------
106108

107-
If you have a working `pip <https://pypi.python.org/pypi/pip>`_ setup,
109+
If you have a working `pip <https://pypi.org/project/pip/>`_ setup,
108110
you should be able to install this backport of pythondialog with::
109111

110112
pip install python2-pythondialog
@@ -224,8 +226,8 @@ version of pythondialog as rendered by Sphinx should be available at:
224226

225227
The sources for the pythondialog Manual are located in the ``doc``
226228
top-level directory of the pythondialog distribution, but the
227-
documentation build process pulls many parts from dialog.py, mainly
228-
docstrings.
229+
documentation build process pulls many parts from ``dialog.py`` (mainly
230+
docstrings).
229231

230232
**Note:**
231233

@@ -237,10 +239,10 @@ docstrings.
237239
work, it is currently not considered a bug---simply download the
238240
reference implementation if you want to do that.
239241

240-
To generate the documentation yourself from dialog.py and the sources in
241-
the ``doc`` directory, first make sure you have `Sphinx`_ and `Make`_
242-
installed. Then, you can go to the ``doc`` directory and type, for
243-
instance::
242+
To generate the documentation yourself from ``dialog.py`` and the
243+
sources in the ``doc`` directory, first make sure you have `Sphinx`_ and
244+
`Make`_ installed. Then, you can go to the ``doc`` directory and type,
245+
for instance::
244246

245247
make html
246248

@@ -338,7 +340,7 @@ Using Xdialog instead of dialog
338340
-------------------------------
339341

340342
As far as I can tell, `Xdialog`_ has not been ported to `GTK+`_ version
341-
2 or later. It is not in `Debian`_ stable nor unstable (June 23, 2013).
343+
2 or later. It is not in `Debian`_ stable nor unstable (November 30, 2019).
342344
It is not installed on my system (because of the GTK+ 1.2 dependency),
343345
and according to the Xdialog-specific patches I received from Peter
344346
Åstrand in 2004, was not a drop-in replacement for `dialog`_ (in

‎setup.cfg‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,2 @@
11
[sdist]
22
formats=bztar,gztar
3-
4-
[bdist]
5-
formats=bztar,gztar

‎setup.py‎

Lines changed: 26 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
from __future__ import with_statement, unicode_literals, print_function
2525
import os, sys, subprocess, traceback
26-
from distutils.core import setup
26+
from setuptools import setup
2727
from io import open
2828

2929

@@ -56,7 +56,7 @@ def run_gitlog_to_changelog(after_this_commit, output=None):
5656
"#! /usr/bin/perl".""".format(
5757
prg=args[0],
5858
underlining="=" * len(args[0]),
59-
url="http://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=blob_plain;"
59+
url="https://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=blob_plain;"
6060
"f=build-aux/gitlog-to-changelog"), file=sys.stderr)
6161
sys.exit(1)
6262

@@ -111,25 +111,35 @@ def main():
111111
version=VERSION,
112112
description="A Python interface to the UNIX dialog utility and "
113113
"mostly-compatible programs (Python 2 backport)",
114-
# Doesn't work great with several authors...
115-
author="Robb Shecter, Sultanbek Tezadov, Florent Rougon, "
116-
"Peter Åstrand",
117-
author_email="robb@acm.org, http://sultan.da.ru/, f.rougon@free.fr, "
118-
"peter@cendio.se",
114+
# According to
115+
# <https://packaging.python.org/specifications/core-metadata/> and
116+
# the rendering on PyPI, it appears that only the original author can
117+
# be listed in 'author'. See the AUTHORS file for other contributors.
118+
author="Robb Shecter",
119+
author_email="robb@acm.org",
119120
maintainer="Florent Rougon",
120121
maintainer_email="f.rougon@free.fr",
121122
url="http://pythondialog.sourceforge.net/",
122-
download_url="http://sourceforge.net/projects/pythondialog/files/\
123-
pythondialog/{version}/python2-{pkg}-{version}.tar.bz2".format(
124-
pkg=PACKAGE, version=VERSION),
123+
project_urls={
124+
"Documentation": "http://pythondialog.sourceforge.net/doc/",
125+
"SourceForge project page":
126+
"https://sourceforge.net/projects/pythondialog",
127+
"Git repository": "https://sourceforge.net/p/pythondialog/code/",
128+
"Mailing list": "https://sourceforge.net/p/pythondialog/mailman/",
129+
"Issue tracker":
130+
"https://sourceforge.net/p/pythondialog/_list/tickets",
131+
},
132+
long_description=long_description,
133+
long_description_content_type="text/x-rst",
134+
keywords=["dialog", "ncurses", "Xdialog", "text-mode interface",
135+
"terminal"],
125136
# Well, there isn't much UNIX-specific code in dialog.py, if at all.
126137
# I am putting Unix here only because of the dialog dependency...
127138
# Note: using the "Unix" case instead of "UNIX", because it is
128-
# spelled this way in Trove classifiers.
139+
# spelled this way in Trove classifiers. This argument should be
140+
# unneeded given the Trove classifers, however omitting it leads to
141+
# an ugly 'Platform: UNKNOWN' in pythondialog.egg-info/PKG-INFO.
129142
platforms=["Unix"],
130-
long_description=long_description,
131-
keywords=["dialog", "ncurses", "Xdialog", "text-mode interface",
132-
"terminal"],
133143
classifiers=[
134144
"Programming Language :: Python :: 2",
135145
"Programming Language :: Python :: 2.6",
@@ -143,6 +153,7 @@ def main():
143153
"Topic :: Software Development :: Libraries :: Python Modules",
144154
"Topic :: Software Development :: User Interfaces",
145155
"Topic :: Software Development :: Widget Sets"],
146-
py_modules=["dialog"])
156+
py_modules=["dialog"],
157+
python_requires=">=2.6, <3")
147158

148159
if __name__ == "__main__": main()

0 commit comments

Comments
 (0)