mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-01-27 04:34:18 +01:00
Use setuptools 'entry_points' instead of distutils-style 'scripts'
A future commit will add aliases for these scripts, and using entry_points will make them easier to set up.
This commit is contained in:
parent
52271d2e6e
commit
0572d49988
12
setup.py
12
setup.py
@ -117,7 +117,9 @@ packages = ['supybot',
|
||||
'supybot.locales',
|
||||
'supybot.utils',
|
||||
'supybot.drivers',
|
||||
'supybot.plugins',] + \
|
||||
'supybot.plugins',
|
||||
'supybot.scripts',
|
||||
] + \
|
||||
['supybot.plugins.'+s for s in plugins] + \
|
||||
[
|
||||
'supybot.plugins.Dict.local',
|
||||
@ -213,7 +215,13 @@ setup(
|
||||
|
||||
package_data=package_data,
|
||||
|
||||
scripts=['scripts/supybot%s' % name for name in scripts],
|
||||
entry_points={
|
||||
'console_scripts': [
|
||||
'supybot%s = supybot.scripts.limnoria%s:main'
|
||||
% (name, name.replace('-', '_'))
|
||||
for name in scripts
|
||||
]
|
||||
},
|
||||
|
||||
data_files=(
|
||||
[('share/man/man1', ['man/supybot%s.1' % name]) for name in scripts]
|
||||
|
0
src/scripts/__init__.py
Normal file
0
src/scripts/__init__.py
Normal file
@ -1,5 +1,3 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
###
|
||||
# Copyright (c) 2003-2004, Jeremiah Fincher
|
||||
# Copyright (c) 2009, James McCoy
|
||||
@ -35,8 +33,6 @@
|
||||
This is the main program to run Supybot.
|
||||
"""
|
||||
|
||||
import supybot
|
||||
|
||||
import re
|
||||
import os
|
||||
import sys
|
||||
@ -78,11 +74,14 @@ except ImportError:
|
||||
|
||||
from supybot.version import version
|
||||
|
||||
def main():
|
||||
def run():
|
||||
import supybot.log as log
|
||||
import supybot.conf as conf
|
||||
import supybot.world as world
|
||||
import supybot.drivers as drivers
|
||||
import supybot.ircmsgs as ircmsgs
|
||||
import supybot.schedule as schedule
|
||||
import supybot.httpserver as httpserver
|
||||
# We schedule this event rather than have it actually run because if there
|
||||
# is a failure between now and the time it takes the Owner plugin to load
|
||||
# all the various plugins, our registry file might be wiped. That's bad.
|
||||
@ -147,7 +146,7 @@ def main():
|
||||
log.info('Total CPU time taken: %.2f seconds.', user+system)
|
||||
log.info('No more Irc objects, exiting.')
|
||||
|
||||
if __name__ == '__main__':
|
||||
def main():
|
||||
parser = optparse.OptionParser(usage='Usage: %prog [options] configFile',
|
||||
version='Limnoria %s running on Python %s' %
|
||||
(version, sys.version))
|
||||
@ -355,7 +354,7 @@ if __name__ == '__main__':
|
||||
import supybot.callbacks as callbacks
|
||||
import supybot.plugins.Owner as Owner
|
||||
|
||||
# These may take some resources, and it does not need to be run while boot, so
|
||||
# This may take some resources, and it does not need to run while booting, so
|
||||
# we import it as late as possible (but before plugins are loaded).
|
||||
import supybot.httpserver as httpserver
|
||||
|
||||
@ -364,9 +363,9 @@ if __name__ == '__main__':
|
||||
if options.profile:
|
||||
import profile
|
||||
world.profiling = True
|
||||
profile.run('main()', '%s-%i.prof' % (nick, time.time()))
|
||||
profile.run('run()', '%s-%i.prof' % (nick, time.time()))
|
||||
else:
|
||||
main()
|
||||
run()
|
||||
|
||||
|
||||
# vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79:
|
@ -53,7 +53,7 @@ def debug(s):
|
||||
s += os.linesep
|
||||
sys.stdout.write(s)
|
||||
|
||||
if __name__ == '__main__':
|
||||
def main()
|
||||
# XXX I wanted this for conf.version, but this will create directories. We
|
||||
# really need to refactor conf so it either doesn't create directories, or
|
||||
# so that static information (like the version) can be imported from
|
||||
@ -135,4 +135,7 @@ if __name__ == '__main__':
|
||||
else:
|
||||
sys.exit(0)
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
||||
# vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79:
|
@ -211,7 +211,7 @@ readmeTemplate = '''
|
||||
%s
|
||||
'''.lstrip()
|
||||
|
||||
def main():
|
||||
def _main():
|
||||
global copyright
|
||||
global license
|
||||
parser = optparse.OptionParser(usage='Usage: %prog [options]',
|
||||
@ -307,13 +307,16 @@ def main():
|
||||
|
||||
print('Your new plugin template is in the %s directory.' % name)
|
||||
|
||||
if __name__ == '__main__':
|
||||
def main():
|
||||
try:
|
||||
main()
|
||||
_main()
|
||||
except KeyboardInterrupt:
|
||||
print()
|
||||
output("""It looks like you cancelled out of this script before it was
|
||||
finished. Obviously, nothing was written, but just run this script
|
||||
again whenever you want to generate a template for a plugin.""")
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
||||
# vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79:
|
@ -276,7 +276,7 @@ def genDoc(m, options):
|
||||
finally:
|
||||
fd.close()
|
||||
|
||||
if __name__ == '__main__':
|
||||
def main():
|
||||
import glob
|
||||
import os.path
|
||||
import optparse
|
||||
@ -349,4 +349,8 @@ if __name__ == '__main__':
|
||||
shutil.rmtree(conf.supybot.directories.conf())
|
||||
shutil.rmtree(conf.supybot.directories.data())
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
||||
# vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=78:
|
@ -40,7 +40,7 @@ import os
|
||||
import sys
|
||||
import optparse
|
||||
|
||||
def main():
|
||||
def _main():
|
||||
import supybot.log as log
|
||||
import supybot.conf as conf
|
||||
conf.supybot.log.stdout.setValue(False)
|
||||
@ -102,10 +102,13 @@ def main():
|
||||
ircdb.users.close()
|
||||
print('User %s\'s password reset!' % name)
|
||||
|
||||
if __name__ == '__main__':
|
||||
def main():
|
||||
try:
|
||||
main()
|
||||
except KeyboardInterrupt:
|
||||
pass
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
||||
# vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79:
|
@ -119,7 +119,7 @@ class path(str):
|
||||
def __eq__(self, other):
|
||||
return self._r.split(self) == self._r.split(other)
|
||||
|
||||
if __name__ == '__main__':
|
||||
def main():
|
||||
import glob
|
||||
import os.path
|
||||
import optparse
|
||||
@ -243,4 +243,8 @@ if __name__ == '__main__':
|
||||
else:
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
||||
# vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79:
|
@ -166,7 +166,7 @@ def getDirectoryName(default, basedir=os.curdir, prompt=True):
|
||||
return (dir, os.path.dirname(orig_dir))
|
||||
|
||||
|
||||
def main():
|
||||
def _main():
|
||||
import supybot.version as version
|
||||
parser = optparse.OptionParser(usage='Usage: %prog [options]',
|
||||
version='Supybot %s' % version.version)
|
||||
@ -815,9 +815,9 @@ def main():
|
||||
just have to start it like you start all your other Python scripts.""" % \
|
||||
(filename, filename))
|
||||
|
||||
if __name__ == '__main__':
|
||||
def main():
|
||||
try:
|
||||
main()
|
||||
_main()
|
||||
except KeyboardInterrupt:
|
||||
# We may still be using bold text when exiting during a prompt
|
||||
if questions.useBold:
|
||||
@ -829,4 +829,8 @@ if __name__ == '__main__':
|
||||
it was done. Unfortunately, I didn't get to write anything to file.
|
||||
Please run the wizard again to completion.""")
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
||||
# vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79:
|
Loading…
Reference in New Issue
Block a user