Skip to content

Commit 996c156

Browse files
committed
issue2550899 Migrate setup.py to setuptools
Also fixes issue2550866 'pip install --editable .' fails Installing roundup requires setuptools package which is available in most OS distrobutions or via pip. Patch by John Kristensen (jerrykan); additional doc changes (upgrade.txt, RELEASE.txt) John Rouillard.
1 parent 5b3c000 commit 996c156

File tree

6 files changed

+89
-192
lines changed

6 files changed

+89
-192
lines changed

.hgignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ build
1414
demo
1515
dist
1616
MANIFEST
17+
roundup.egg-info
1718
_test_*
1819
*.cover
1920
share/doc/roundup/html

CHANGES.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,11 @@ Fixed:
8080
'local'. Fix traceback caused by DateHTMLProperty.pretty() called
8181
on a string value due to error in some other field. (Reported by
8282
reda, fix: John Rouillard)
83+
- issue2550899 - Migrate setup.py to setuptools; fixes:
84+
issue2550866 'pip install --editable .' fails; et al.
85+
this now requires that setuptools be installed. (Patch by John
86+
Kristensen (jerrykan); additional doc changes (upgrade.txt,
87+
RELEASE.txt) John Rouillard)
8388

8489
Features:
8590
- issue2550522 - Add 'filter' command to command-line

RELEASE.txt

Lines changed: 63 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -47,53 +47,90 @@ Roundup release checklist:
4747
rm -rf build/share # deletes locale .mo files
4848
Rebuild and install .mo files
4949
python setup.py build (sdist generation will fail if this isn't done)
50-
8. Rebuild documentation in "share/doc/roundup/html"
50+
8. Check documentation:
51+
python setup.py check --restructuredtext --metadata --strict
52+
Rebuild documentation in "share/doc/roundup/html"
5153
python setup.py build_doc
52-
9. python setup.py sdist --manifest-only
53-
(ignore the 'warning: no previously-included ...' lines)
54-
10. Check the MANIFEST to make sure that any new files are included.
55-
(use hg status --rev <last release or tag>:tip to list changed
56-
added and removed files. Last release e.g. 1.5.1 where tip was
57-
what would become 1.6) E.G.
54+
9. python setup.py sdist
55+
(if you find sdist a little verbose, add "--quiet" to the end of the
56+
command)
57+
9a. 2021/04/17 skip this for now. Need to make sure that whl installs
58+
execuable scripts properly and update these directions to test.
59+
60+
python2 setup.py bdist_wheel; python3 setup.py bdist_wheel
61+
62+
to create binary distributions in wheel format. (egg format is
63+
deprecated.)
64+
10. Check the roundup.egg-info/SOURCES.txt to make sure that any new files are
65+
included. (use hg status --rev <last release or tag>:tip to list changed
66+
added and removed files. Last release e.g. 1.5.1 where tip was what would
67+
become 1.6) E.G.
5868

5969
hg status --rev 1.6.0:tip | sed -ne 's/^A //p' | while read i ; \
60-
do echo $i; grep "$i" MANIFEST; done | uniq -c
70+
do echo $i; grep "$i" roundup.egg-info/SOURCES.txt; done | uniq -c
6171

6272
Anything with a count of 1 is not in the manifest.
6373
If there are missing files that should be in the manifest,
6474
edit MANIFEST.in to include them. For format docs see
65-
http://docs.python.org/2/distutils/sourcedist.html#manifest-template
66-
(Notes files for the website and issue tracker shouldn't be in the
67-
manifest.)
68-
11. python setup.py sdist
69-
(if you find sdist a little verbose, add "--quiet" to the end of the
70-
command)
71-
12. Unpack the new tarball created in dist/roundup-<version>.tar.gz
75+
https://packaging.python.org/guides/using-manifest-in/#using-manifest-in
76+
(Note: files under website/ shouldn't be in the manifest.)
77+
11. Unpack the new tarball created in dist/roundup-<version>.tar.gz
7278
file in /tmp then
7379
a) run tests using installed pytest run under python2 and
7480
python3. (python2 -m pytest test/; python3 -m pytest test/)
7581
b) demo.py
7682
with all available Python versions.
77-
13. Assuming all is well tag the release in the version-control
83+
11a. (TBD how to test wheel binary distribution before uploading.)
84+
12. Assuming all is well tag the release in the version-control
7885
system.
7986
a) hg tag 1.6.0 # use right version. Should create/commit a changeset
8087
b) hg push # update main repo
8188
c) hg sum # verify that the tag shows up
82-
14. Upload source distribution to PyPI - requires you sign up for a
89+
13. Upload source distribution to PyPI - requires you sign up for a
8390
pypi account and be added as a maintainer to roundup. Ask existing
84-
maintainer for access.
91+
maintainer for access. You can do this two ways:
92+
8593
python setup.py sdist upload --repository pypi --sign
86-
It should appear on http://pypi.python.org/pypi/roundup in no
87-
time. If you are using python older than 2.7.13 you need a
88-
.pypirc shown below. URL has changed. If using 2.7.13 or newer,
89-
you can remove the "--repository pypi" option.
90-
15. Send doc/announcement.txt to [email protected] and
94+
95+
which rebuilds the source distribution tarball and uploads it.
96+
This means that you have uploaded something tha is not tested. It
97+
should be the same as the tarball you tested but....
98+
99+
Another way to do this is to use twine (pip install twine).
100+
You need to sign the tarball. This can be done with:
101+
102+
gpg --detach-sign --armor <filename>.tgz
103+
104+
you should be prompted to use the roundup release key. If not you
105+
106+
This will create a file by the name <filename>.tgz.asc. Then
107+
use twine to upload *both* the asc and distibution tarball
108+
at the same time. E.G.:x
109+
110+
twine upload --repository pypi <filename>.tar.gz <filename>.tar.gz.asc
111+
112+
(If you upload the .asc file separately from the distibution file
113+
it gets a different path and is not able to be located in the pypi
114+
interface. The asc file is downloaded using the tarball path and
115+
add `asc'.)
116+
117+
The distribution file should appear on
118+
https://pypi.python.org/pypi/roundup in no time. If you are using
119+
python older than 2.7.13 you need a .pypirc shown below since the
120+
URL has changed. If using 2.7.13 or newer, you can remove the
121+
"--repository pypi" option and use 'setup.py sdist upload...'.
122+
123+
You can also use twine to upload the .whl (wheel) format
124+
distributions (if created). Follow the directions for generating
125+
the gpg asc files and upload the .whl distribution and .whl.asc
126+
signature files together.
127+
14. Send doc/announcement.txt to [email protected] and
91128
92129
93-
15b. Update entry on https://freshcode.club/projects/roundup-tracker
94-
15c. Update entries for fossies by emailing announcement to
130+
14b. Update entry on https://freshcode.club/projects/roundup-tracker
131+
14c. Update entries for fossies by emailing announcement to
95132
96-
16. Refresh website.
133+
15. Refresh website.
97134
website/README.txt
98135
https://www.roundup-tracker.org/ should state that the stable
99136
version is the one that you released.
@@ -113,7 +150,6 @@ So, those commands in a nice, cut'n'pasteable form::
113150
cd locale
114151
make
115152
cd ..
116-
python setup.py sdist --manifest-only
117153
python setup.py sdist --quiet
118154
## python setup.py bdist_rpm
119155
# not required for pypi.org since 2017 -> python setup.py register

doc/upgrading.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,15 @@ Contents:
2727
Migrating from 2.0.0 to 2.x.x
2828
=============================
2929

30+
Setuptools is now required to install
31+
-------------------------------------
32+
33+
Roundup install now uses setuptools rather than distutils. You must
34+
install setuptools. Use the version packgaged by your OS vendor. If
35+
your OS vendor doesn't supply setuptools use ``pip install
36+
setuptools``. (You may need pip3 rather than pip if using python3.)
37+
38+
3039
Classname Format Enforced
3140
-------------------------
3241

roundup/dist/command/build_scripts.py

Lines changed: 0 additions & 149 deletions
This file was deleted.

setup.py

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,11 @@
2121

2222
from __future__ import print_function
2323
from roundup.dist.command.build_doc import build_doc
24-
from roundup.dist.command.build_scripts import build_scripts
2524
from roundup.dist.command.build import build, list_message_files
2625
from roundup.dist.command.bdist_rpm import bdist_rpm
2726
from roundup.dist.command.install_lib import install_lib
2827

29-
# FIXME: setuptools breaks the --manifest-only option to setup.py and
30-
# doesn't seem to generate a MANIFEST file. Since I'm not familiar with
31-
# the way setuptools handles the files to include I'm commenting this
32-
# for now -- Ralf Schlatterbeck
33-
#try:
34-
# from setuptools import setup
35-
#except ImportError:
36-
from distutils.core import setup
28+
from setuptools import setup
3729

3830
import sys, os
3931
from glob import glob
@@ -48,13 +40,15 @@ def include(d, e):
4840

4941
return (d, [f for f in glob('%s/%s'%(d, e)) if os.path.isfile(f)])
5042

51-
def scriptname(path):
43+
44+
def mapscript(path):
5245
""" Helper for building a list of script names from a list of
5346
module files.
5447
"""
55-
script = os.path.splitext(os.path.basename(path))[0]
56-
script = script.replace('_', '-')
57-
return script
48+
module = os.path.splitext(os.path.basename(path))[0]
49+
script = module.replace('_', '-')
50+
return '%s = roundup.scripts.%s:run' % (script, module)
51+
5852

5953
def main():
6054
# template munching
@@ -71,7 +65,7 @@ def main():
7165
]
7266

7367
# build list of scripts from their implementation modules
74-
scripts = [scriptname(f) for f in glob('roundup/scripts/[!_]*.py')]
68+
scripts = [mapscript(f) for f in glob('roundup/scripts/[!_]*.py')]
7569

7670
data_files = [
7771
('share/roundup/cgi-bin', ['frontends/roundup.cgi']),
@@ -161,13 +155,14 @@ def main():
161155

162156
# Override certain command classes with our own ones
163157
cmdclass= {'build_doc': build_doc,
164-
'build_scripts': build_scripts,
165158
'build': build,
166159
'bdist_rpm': bdist_rpm,
167160
'install_lib': install_lib,
168161
},
169162
packages=packages,
170-
scripts=scripts,
163+
entry_points={
164+
'console_scripts': scripts
165+
},
171166
data_files=data_files)
172167

173168
if __name__ == '__main__':

0 commit comments

Comments
 (0)