Merge branch 'improved-ebuild' into develop
This commit is contained in:
commit
1773750485
|
@ -1 +1 @@
|
|||
EBUILD powerline-9999.ebuild 3436 SHA256 9a09866972c18adb5bc3b9394ae8ec98e305aef27e7558803dd89f499829fa48 SHA512 620363137d24ca57457d97fabb95108e515aec2ce986d7dc6abb4b5c68ef2866e55a4024005efc91f7f84fcac58b79c9445af93e3bfff3d1c12aba462c8e8a61 WHIRLPOOL 227ab590e91c97fbe9b720c882d422ee7c05d0637c174cde48f4cd1f683653f14e67914abdb9ba03406d5090d6a56a96e546c501fb1b10961ddaa4005c04b686
|
||||
EBUILD powerline-9999.ebuild 3916 SHA256 754f8750aa5c6a455871d44c9478b81278b71318e591a13ef30f763ddb1fbda5 SHA512 48dd9d3ac737417b6a072397a4a50fefc04c0cb4a3c6249b5bf11ee201986f7b25a94b83e6901e8099ae3ea733dc0e650f5ce2234b5143bdbafd906af56916e7 WHIRLPOOL 803298b97adaeb2e3a6cd31c4bd12897373d7ce0722df22a991c684ecd5146fcd87addfc6e428374d924d6cb950dee6bbcf2ea0a262904cc4d04e3eac0b2dcb8
|
||||
|
|
|
@ -16,10 +16,10 @@ DESCRIPTION="The ultimate statusline/prompt utility."
|
|||
HOMEPAGE="http://github.com/Lokaltog/powerline"
|
||||
SRC_URI=""
|
||||
|
||||
LICENSE="CC-Attribution-ShareAlike-3.0"
|
||||
LICENSE="MIT"
|
||||
SLOT="0"
|
||||
KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~ppc-aix ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~x64-freebsd ~x86-freebsd ~hppa-hpux ~ia64-hpux ~x86-interix ~amd64-linux ~ia64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
|
||||
IUSE="vim zsh doc awesome tmux bash ipython"
|
||||
IUSE="vim zsh doc awesome tmux bash ipython test git"
|
||||
|
||||
#if LIVE
|
||||
SRC_URI=
|
||||
|
@ -28,10 +28,31 @@ KEYWORDS=
|
|||
|
||||
S="${WORKDIR}/${PN}"
|
||||
|
||||
COMMON_DEPEND="
|
||||
virtual/python-argparse
|
||||
"
|
||||
RDEPEND="
|
||||
${COMMON_DEPEND}
|
||||
vim? ( || ( app-editors/vim[python] app-editors/gvim[python] ) )
|
||||
awesome? ( >=x11-wm/awesome-3.5 )"
|
||||
DEPEND="doc? ( dev-python/sphinx dev-python/docutils )"
|
||||
awesome? ( >=x11-wm/awesome-3.5 )
|
||||
git? ( || ( >=dev-vcs/git-1.7.2 >=dev-python/pygit2-0.17 ) )
|
||||
"
|
||||
DEPEND="
|
||||
${COMMON_DEPEND}
|
||||
doc? ( dev-python/sphinx dev-python/docutils )
|
||||
test? (
|
||||
python_targets_python2_6? ( virtual/python-unittest2 )
|
||||
|| ( >=dev-vcs/git-1.7.2 >=dev-python/pygit2-0.17 )
|
||||
python_targets_python2_6? (
|
||||
dev-vcs/mercurial
|
||||
dev-vcs/bzr
|
||||
)
|
||||
python_targets_python2_7? (
|
||||
dev-vcs/mercurial
|
||||
dev-vcs/bzr
|
||||
)
|
||||
)
|
||||
"
|
||||
|
||||
FONT_SUFFIX="otf"
|
||||
FONT_S="${S}/font"
|
||||
|
@ -40,6 +61,10 @@ FONT_CONF=(
|
|||
"${FONT_S}/10-powerline-symbols.conf"
|
||||
)
|
||||
|
||||
python_test() {
|
||||
PYTHON="${PYTHON}" tests/test.sh || die "Tests fail with ${EPYTHON}"
|
||||
}
|
||||
|
||||
src_compile() {
|
||||
distutils-r1_src_compile
|
||||
if use doc ; then
|
||||
|
|
2
setup.py
2
setup.py
|
@ -27,7 +27,7 @@ setup(
|
|||
'scripts/powerline',
|
||||
],
|
||||
keywords='',
|
||||
packages=find_packages(exclude=('tests',)),
|
||||
packages=find_packages(exclude=('tests', 'tests.*')),
|
||||
include_package_data=True,
|
||||
zip_safe=False,
|
||||
install_requires=[],
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
#!/bin/sh
|
||||
if python -c 'import sys; sys.exit(1 * (sys.version_info >= (2, 7)))' ; then
|
||||
: ${PYTHON:=python}
|
||||
if ${PYTHON} -c 'import sys; sys.exit(1 * (sys.version_info >= (2, 7)))' ; then
|
||||
# Python 2.6
|
||||
export PYTHONPATH="${PYTHONPATH}:`realpath .`"
|
||||
for file in tests/test_*.py ; do
|
||||
if ! python $file ; then
|
||||
if ! ${PYTHON} $file ; then
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
else
|
||||
python setup.py test
|
||||
${PYTHON} setup.py test
|
||||
fi
|
||||
|
|
|
@ -45,93 +45,99 @@ use_mercurial = use_bzr = sys.version_info < (3, 0)
|
|||
|
||||
class TestVCS(TestCase):
|
||||
def test_git(self):
|
||||
repo = guess(path='git_repo')
|
||||
repo = guess(path=GIT_REPO)
|
||||
self.assertNotEqual(repo, None)
|
||||
self.assertEqual(repo.branch(), 'master')
|
||||
self.assertEqual(repo.status(), ' ')
|
||||
self.assertEqual(repo.status('file'), None)
|
||||
with open(os.path.join('git_repo', 'file'), 'w') as f:
|
||||
with open(os.path.join(GIT_REPO, 'file'), 'w') as f:
|
||||
f.write('abc')
|
||||
f.flush()
|
||||
self.assertEqual(repo.status(), ' U')
|
||||
self.assertEqual(repo.status('file'), '??')
|
||||
call(['git', 'add', '.'], cwd='git_repo')
|
||||
call(['git', 'add', '.'], cwd=GIT_REPO)
|
||||
self.assertEqual(repo.status(), ' I ')
|
||||
self.assertEqual(repo.status('file'), 'A ')
|
||||
f.write('def')
|
||||
f.flush()
|
||||
self.assertEqual(repo.status(), 'DI ')
|
||||
self.assertEqual(repo.status('file'), 'AM')
|
||||
os.remove(os.path.join('git_repo', 'file'))
|
||||
os.remove(os.path.join(GIT_REPO, 'file'))
|
||||
|
||||
if use_mercurial:
|
||||
def test_mercurial(self):
|
||||
repo = guess(path='hg_repo')
|
||||
repo = guess(path=HG_REPO)
|
||||
self.assertNotEqual(repo, None)
|
||||
self.assertEqual(repo.branch(), 'default')
|
||||
with open(os.path.join('hg_repo', 'file'), 'w') as f:
|
||||
with open(os.path.join(HG_REPO, 'file'), 'w') as f:
|
||||
f.write('abc')
|
||||
f.flush()
|
||||
self.assertEqual(repo.status(), ' U')
|
||||
self.assertEqual(repo.status('file'), 'U')
|
||||
call(['hg', 'add', '.'], cwd='hg_repo', stdout=PIPE)
|
||||
call(['hg', 'add', '.'], cwd=HG_REPO, stdout=PIPE)
|
||||
self.assertEqual(repo.status(), 'D ')
|
||||
self.assertEqual(repo.status('file'), 'A')
|
||||
os.remove(os.path.join('hg_repo', 'file'))
|
||||
os.remove(os.path.join(HG_REPO, 'file'))
|
||||
|
||||
if use_bzr:
|
||||
def test_bzr(self):
|
||||
repo = guess(path='bzr_repo')
|
||||
repo = guess(path=BZR_REPO)
|
||||
self.assertNotEqual(repo, None, 'No bzr repo found. Do you have bzr installed?')
|
||||
self.assertEqual(repo.branch(), 'test_powerline')
|
||||
self.assertEqual(repo.status(), None)
|
||||
with open(os.path.join('bzr_repo', 'file'), 'w') as f:
|
||||
with open(os.path.join(BZR_REPO, 'file'), 'w') as f:
|
||||
f.write('abc')
|
||||
self.assertEqual(repo.status(), ' U')
|
||||
self.assertEqual(repo.status('file'), '? ')
|
||||
call(['bzr', 'add', '.'], cwd='bzr_repo', stdout=PIPE)
|
||||
call(['bzr', 'add', '.'], cwd=BZR_REPO, stdout=PIPE)
|
||||
self.assertEqual(repo.status(), 'D ')
|
||||
self.assertEqual(repo.status('file'), '+N')
|
||||
call(['bzr', 'commit', '-m', 'initial commit'], cwd='bzr_repo', stdout=PIPE, stderr=PIPE)
|
||||
call(['bzr', 'commit', '-m', 'initial commit'], cwd=BZR_REPO, stdout=PIPE, stderr=PIPE)
|
||||
self.assertEqual(repo.status(), None)
|
||||
with open(os.path.join('bzr_repo', 'file'), 'w') as f:
|
||||
with open(os.path.join(BZR_REPO, 'file'), 'w') as f:
|
||||
f.write('def')
|
||||
self.assertEqual(repo.status(), 'D ')
|
||||
self.assertEqual(repo.status('file'), ' M')
|
||||
self.assertEqual(repo.status('notexist'), None)
|
||||
os.remove(os.path.join('bzr_repo', 'file'))
|
||||
os.remove(os.path.join(BZR_REPO, 'file'))
|
||||
|
||||
old_HGRCPATH = None
|
||||
old_cwd = None
|
||||
|
||||
|
||||
GIT_REPO = 'git_repo' + os.environ.get('PYTHON', '')
|
||||
HG_REPO = 'hg_repo' + os.environ.get('PYTHON', '')
|
||||
BZR_REPO = 'bzr_repo' + os.environ.get('PYTHON', '')
|
||||
|
||||
|
||||
def setUpModule():
|
||||
global old_cwd
|
||||
global old_HGRCPATH
|
||||
old_cwd = os.getcwd()
|
||||
os.chdir(os.path.dirname(__file__))
|
||||
call(['git', 'init', '--quiet', 'git_repo'])
|
||||
call(['git', 'config', '--local', 'user.name', 'Foo'], cwd='git_repo')
|
||||
call(['git', 'config', '--local', 'user.email', 'bar@example.org'], cwd='git_repo')
|
||||
call(['git', 'commit', '--allow-empty', '--message', 'Initial commit', '--quiet'], cwd='git_repo')
|
||||
call(['git', 'init', '--quiet', GIT_REPO])
|
||||
assert os.path.isdir(GIT_REPO)
|
||||
call(['git', 'config', '--local', 'user.name', 'Foo'], cwd=GIT_REPO)
|
||||
call(['git', 'config', '--local', 'user.email', 'bar@example.org'], cwd=GIT_REPO)
|
||||
call(['git', 'commit', '--allow-empty', '--message', 'Initial commit', '--quiet'], cwd=GIT_REPO)
|
||||
if use_mercurial:
|
||||
old_HGRCPATH = os.environ.get('HGRCPATH')
|
||||
os.environ['HGRCPATH'] = ''
|
||||
call(['hg', 'init', 'hg_repo'])
|
||||
with open(os.path.join('hg_repo', '.hg', 'hgrc'), 'w') as hgrc:
|
||||
call(['hg', 'init', HG_REPO])
|
||||
with open(os.path.join(HG_REPO, '.hg', 'hgrc'), 'w') as hgrc:
|
||||
hgrc.write('[ui]\n')
|
||||
hgrc.write('username = Foo <bar@example.org>\n')
|
||||
if use_bzr:
|
||||
call(['bzr', 'init', '--quiet', 'bzr_repo'])
|
||||
call(['bzr', 'config', 'email=Foo <bar@example.org>'], cwd='bzr_repo')
|
||||
call(['bzr', 'config', 'nickname=test_powerline'], cwd='bzr_repo')
|
||||
call(['bzr', 'config', 'create_signatures=0'], cwd='bzr_repo')
|
||||
call(['bzr', 'init', '--quiet', BZR_REPO])
|
||||
call(['bzr', 'config', 'email=Foo <bar@example.org>'], cwd=BZR_REPO)
|
||||
call(['bzr', 'config', 'nickname=test_powerline'], cwd=BZR_REPO)
|
||||
call(['bzr', 'config', 'create_signatures=0'], cwd=BZR_REPO)
|
||||
|
||||
|
||||
def tearDownModule():
|
||||
global old_cwd
|
||||
global old_HGRCPATH
|
||||
for repo_dir in (['git_repo'] + (['hg_repo'] if use_mercurial else []) + (['bzr_repo'] if use_bzr else [])):
|
||||
for repo_dir in [GIT_REPO] + ([HG_REPO] if use_mercurial else []) + ([BZR_REPO] if use_bzr else []):
|
||||
for root, dirs, files in list(os.walk(repo_dir, topdown=False)):
|
||||
for file in files:
|
||||
os.remove(os.path.join(root, file))
|
||||
|
|
Loading…
Reference in New Issue