mirror of
https://github.com/asciinema/asciinema.git
synced 2025-12-16 11:48:13 +01:00
Proper python package layout
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -3,3 +3,5 @@ tmp
|
|||||||
pkg/*.tar.gz
|
pkg/*.tar.gz
|
||||||
pkg/*.tar.bz2
|
pkg/*.tar.bz2
|
||||||
pkg/*.zip
|
pkg/*.zip
|
||||||
|
*.egg-info
|
||||||
|
/build
|
||||||
|
|||||||
2
Makefile
2
Makefile
@@ -72,7 +72,7 @@ tmp/asciinema.zip: src/* src/commands/*
|
|||||||
test: test-unit test-integration
|
test: test-unit test-integration
|
||||||
|
|
||||||
test-unit:
|
test-unit:
|
||||||
PYTHONPATH=tests nosetests `find tests -name "*_test.py"`
|
nosetests
|
||||||
|
|
||||||
test-integration:
|
test-integration:
|
||||||
tests/integration.sh
|
tests/integration.sh
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import sys
|
import sys
|
||||||
|
|
||||||
from config import Config
|
from .config import Config
|
||||||
from commands.builder import get_command
|
from .commands.builder import get_command
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
get_command(sys.argv[1:], Config()).execute()
|
get_command(sys.argv[1:], Config()).execute()
|
||||||
0
asciinema/commands/__init__.py
Normal file
0
asciinema/commands/__init__.py
Normal file
@@ -1,10 +1,10 @@
|
|||||||
import getopt
|
import getopt
|
||||||
|
|
||||||
from commands.error import ErrorCommand
|
from .error import ErrorCommand
|
||||||
from commands.record import RecordCommand
|
from .record import RecordCommand
|
||||||
from commands.auth import AuthCommand
|
from .auth import AuthCommand
|
||||||
from commands.help import HelpCommand
|
from .help import HelpCommand
|
||||||
from commands.version import VersionCommand
|
from .version import VersionCommand
|
||||||
|
|
||||||
|
|
||||||
def get_command(argv, config):
|
def get_command(argv, config):
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
from recorder import Recorder
|
from asciinema.recorder import Recorder
|
||||||
from uploader import Uploader
|
from asciinema.uploader import Uploader
|
||||||
from confirmator import Confirmator
|
from asciinema.confirmator import Confirmator
|
||||||
|
|
||||||
|
|
||||||
class RecordCommand(object):
|
class RecordCommand(object):
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
from common import VERSION
|
from asciinema.common import VERSION
|
||||||
|
|
||||||
|
|
||||||
class VersionCommand(object):
|
class VersionCommand(object):
|
||||||
BIN
bin/asciinema
BIN
bin/asciinema
Binary file not shown.
24
setup.py
Normal file
24
setup.py
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
try:
|
||||||
|
from setuptools import setup
|
||||||
|
except ImportError:
|
||||||
|
from distutils.core import setup
|
||||||
|
|
||||||
|
config = {
|
||||||
|
'name': 'asciinema',
|
||||||
|
'version': '0.9.5',
|
||||||
|
'packages': ['asciinema', 'asciinema.commands'],
|
||||||
|
'license': 'MIT',
|
||||||
|
'description': 'Command line recorder for asciinema.org service',
|
||||||
|
'author': 'Marcin Kulik',
|
||||||
|
'author_email': 'm@ku1ik.com',
|
||||||
|
'url': 'http://asciinema.org',
|
||||||
|
'download_url': 'https://github.com/sickill/asciinema/archive/v0.9.5.tar.gz',
|
||||||
|
'install_requires': [],
|
||||||
|
'entry_points': {
|
||||||
|
'console_scripts': [
|
||||||
|
'asciinema = asciinema.__main__:main',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
setup(**config)
|
||||||
0
tests/__init__.py
Normal file
0
tests/__init__.py
Normal file
@@ -1,6 +1,6 @@
|
|||||||
import re
|
import re
|
||||||
|
|
||||||
from commands.auth import AuthCommand
|
from asciinema.commands.auth import AuthCommand
|
||||||
from test_helper import assert_printed, Test
|
from test_helper import assert_printed, Test
|
||||||
|
|
||||||
|
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
from nose.tools import assert_equal
|
from nose.tools import assert_equal
|
||||||
|
|
||||||
from commands.builder import get_command
|
from asciinema.commands.builder import get_command
|
||||||
from commands.error import ErrorCommand
|
from asciinema.commands.error import ErrorCommand
|
||||||
from commands.record import RecordCommand
|
from asciinema.commands.record import RecordCommand
|
||||||
from commands.auth import AuthCommand
|
from asciinema.commands.auth import AuthCommand
|
||||||
from commands.help import HelpCommand
|
from asciinema.commands.help import HelpCommand
|
||||||
from commands.version import VersionCommand
|
from asciinema.commands.version import VersionCommand
|
||||||
|
|
||||||
|
|
||||||
class Config(object):
|
class Config(object):
|
||||||
@@ -4,7 +4,7 @@ import os
|
|||||||
import tempfile
|
import tempfile
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from config import Config
|
from asciinema.config import Config
|
||||||
|
|
||||||
|
|
||||||
def create_config(content=None, overrides={}):
|
def create_config(content=None, overrides={}):
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import sys
|
import sys
|
||||||
|
|
||||||
from confirmator import Confirmator
|
from asciinema.confirmator import Confirmator
|
||||||
from test_helper import assert_printed, assert_not_printed, Test
|
from test_helper import assert_printed, assert_not_printed, Test
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
from nose.tools import assert_raises
|
from nose.tools import assert_raises
|
||||||
|
|
||||||
from commands.error import ErrorCommand
|
from asciinema.commands.error import ErrorCommand
|
||||||
from test_helper import assert_printed, Test
|
from test_helper import assert_printed, Test
|
||||||
|
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
from commands.help import HelpCommand
|
from asciinema.commands.help import HelpCommand
|
||||||
from test_helper import assert_printed, Test
|
from test_helper import assert_printed, Test
|
||||||
|
|
||||||
|
|
||||||
@@ -4,7 +4,7 @@ set -e
|
|||||||
|
|
||||||
test() {
|
test() {
|
||||||
echo "Test: $1"
|
echo "Test: $1"
|
||||||
eval "python2 src $2 >/dev/null || (echo 'failed' && exit 1)"
|
eval "PYTHONPATH=. python2 -m asciinema $2 >/dev/null || (echo 'failed' && exit 1)"
|
||||||
}
|
}
|
||||||
|
|
||||||
test "help" "-h"
|
test "help" "-h"
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ import pty
|
|||||||
from nose.tools import assert_equal
|
from nose.tools import assert_equal
|
||||||
from test_helper import Test
|
from test_helper import Test
|
||||||
|
|
||||||
from stdout import Stdout
|
from asciinema.stdout import Stdout
|
||||||
from pty_recorder import PtyRecorder
|
from asciinema.pty_recorder import PtyRecorder
|
||||||
|
|
||||||
|
|
||||||
class FakeStdout(object):
|
class FakeStdout(object):
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import sys
|
|||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
from nose.tools import assert_equal
|
from nose.tools import assert_equal
|
||||||
from commands.record import RecordCommand
|
from asciinema.commands.record import RecordCommand
|
||||||
from test_helper import assert_printed, assert_not_printed, Test
|
from test_helper import assert_printed, assert_not_printed, Test
|
||||||
|
|
||||||
|
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
from nose.tools import assert_equal
|
from nose.tools import assert_equal
|
||||||
|
|
||||||
from test_helper import Test
|
from test_helper import Test
|
||||||
from recorder import Recorder
|
from asciinema.recorder import Recorder
|
||||||
import timer
|
import asciinema.timer
|
||||||
|
|
||||||
|
|
||||||
class FakePtyRecorder(object):
|
class FakePtyRecorder(object):
|
||||||
@@ -28,11 +28,11 @@ class TestRecorder(Test):
|
|||||||
def setUp(self):
|
def setUp(self):
|
||||||
Test.setUp(self)
|
Test.setUp(self)
|
||||||
self.pty_recorder = FakePtyRecorder()
|
self.pty_recorder = FakePtyRecorder()
|
||||||
self.real_timeit = timer.timeit
|
self.real_timeit = asciinema.timer.timeit
|
||||||
timer.timeit = lambda c, *args: (123.45, c(*args))
|
asciinema.timer.timeit = lambda c, *args: (123.45, c(*args))
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
timer.timeit = self.real_timeit
|
asciinema.timer.timeit = self.real_timeit
|
||||||
|
|
||||||
def test_record_when_title_and_command_given(self):
|
def test_record_when_title_and_command_given(self):
|
||||||
recorder = Recorder(self.pty_recorder)
|
recorder = Recorder(self.pty_recorder)
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import time
|
|||||||
|
|
||||||
from nose.tools import assert_equal, assert_raises
|
from nose.tools import assert_equal, assert_raises
|
||||||
from test_helper import Test, FakeClock
|
from test_helper import Test, FakeClock
|
||||||
from stdout import Stdout, StdoutTiming
|
from asciinema.stdout import Stdout, StdoutTiming
|
||||||
|
|
||||||
|
|
||||||
class TestStdoutTiming(Test):
|
class TestStdoutTiming(Test):
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import time
|
|||||||
|
|
||||||
from nose.tools import assert_equal
|
from nose.tools import assert_equal
|
||||||
from test_helper import Test, FakeClock
|
from test_helper import Test, FakeClock
|
||||||
from timer import timeit
|
from asciinema.timer import timeit
|
||||||
|
|
||||||
|
|
||||||
class TestTimer(Test):
|
class TestTimer(Test):
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
from commands.version import VersionCommand
|
from asciinema.commands.version import VersionCommand
|
||||||
from common import VERSION
|
from asciinema.common import VERSION
|
||||||
from test_helper import assert_printed, Test
|
from test_helper import assert_printed, Test
|
||||||
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user