Skip to content

Commit d86f99a

Browse files
committed
Make packageable
Rearrange file layout for python packaging Add setup.py Use python3 style relative imports Add calm and mksetupini script entry points Fix tests to locate testdata in the same directory
1 parent a194802 commit d86f99a

File tree

209 files changed

+97
-49
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

209 files changed

+97
-49
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ python:
55
install: "pip install pep8 dirq"
66
script:
77
- ./pep8
8-
- ./tests.py
8+
- python -m unittest discover

calm

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

calm.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/usr/bin/env bash
2+
export PYTHONPATH=$(dirname "$0")
3+
exec python3 -m calm.calm "$@"
File renamed without changes.

buffering_smtp_handler.py renamed to calm/buffering_smtp_handler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
import logging.handlers
2626
import email.message
2727

28-
import common_constants
28+
from . import common_constants
2929

3030

3131
class BufferingSMTPHandler(logging.handlers.BufferingHandler):

calm.py renamed to calm/calm.py

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,15 @@
5858
import sys
5959
import tempfile
6060

61-
from abeyance_handler import AbeyanceHandler
62-
from buffering_smtp_handler import BufferingSMTPHandler
63-
import common_constants
64-
import maintainers
65-
import package
66-
import pkg2html
67-
import queue
68-
import setup_exe
69-
import uploads
61+
from .abeyance_handler import AbeyanceHandler
62+
from .buffering_smtp_handler import BufferingSMTPHandler
63+
from . import common_constants
64+
from . import maintainers
65+
from . import package
66+
from . import pkg2html
67+
from . import queue
68+
from . import setup_exe
69+
from . import uploads
7070

7171

7272
#
@@ -188,7 +188,7 @@ def process(args):
188188
#
189189
#
190190

191-
def main(args):
191+
def do_main(args):
192192
# read package set and process uploads
193193
packages = process(args)
194194

@@ -287,7 +287,7 @@ def mail_logs(enabled, toaddrs, subject, thresholdLevel, retainLevel=None):
287287
#
288288
#
289289

290-
if __name__ == "__main__":
290+
def main():
291291
htdocs_default = os.path.join(common_constants.HTDOCS, 'packages')
292292
homedir_default = common_constants.HOMEDIR
293293
orphanmaint_default = common_constants.ORPHANMAINT
@@ -342,4 +342,12 @@ def mail_logs(enabled, toaddrs, subject, thresholdLevel, retainLevel=None):
342342
if args.email:
343343
args.email = args.email.split(',')
344344

345-
sys.exit(main(args))
345+
do_main(args)
346+
347+
348+
#
349+
#
350+
#
351+
352+
if __name__ == "__main__":
353+
sys.exit(main())
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)