Skip to content

Commit 3a7410d

Browse files
committed
Fix setup.py to allow "development mode" (issue2550866)
The setup.py script would fail with missing file errors when attempting to install roundup using "development mode" (eg. pip install -e roundup/). Thanks to tonich for the initial patch to fix the issue using console_scripts
1 parent e45f33f commit 3a7410d

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

CHANGES.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,8 @@ Fixed:
139139
provide protection for invalid content-type, in which case browser
140140
tried to guess the best one. Thanks to Kay Hayen for reporting and
141141
helping debug this. issue2550848 (Ralf Schlatterbeck, anatoly techtonik)
142+
- Fix issue2550866 '"pip install --editable ." fails'. Thanks to tonich for the
143+
initial patch (John Kristensen)
142144

143145

144146

setup.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,15 @@ def include(d, e):
5252

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

55-
def scriptname(path):
55+
56+
def mapscript(path):
5657
""" Helper for building a list of script names from a list of
5758
module files.
5859
"""
59-
script = os.path.splitext(os.path.basename(path))[0]
60-
script = script.replace('_', '-')
61-
return script
60+
module = os.path.splitext(os.path.basename(path))[0]
61+
script = module.replace('_', '-')
62+
return '%s = roundup.scripts.%s:run' % (script, module)
63+
6264

6365
def main():
6466
# template munching
@@ -74,7 +76,7 @@ def main():
7476
]
7577

7678
# build list of scripts from their implementation modules
77-
scripts = [scriptname(f) for f in glob('roundup/scripts/[!_]*.py')]
79+
scripts = [mapscript(f) for f in glob('roundup/scripts/[!_]*.py')]
7880

7981
data_files = [
8082
('share/roundup/cgi-bin', ['frontends/roundup.cgi']),
@@ -155,7 +157,9 @@ def main():
155157
'install_lib': install_lib,
156158
},
157159
packages=packages,
158-
scripts=scripts,
160+
entry_points={
161+
'console_scripts': scripts
162+
},
159163
data_files=data_files)
160164

161165
if __name__ == '__main__':

0 commit comments

Comments
 (0)