use pkg version
This commit is contained in:
parent
74d7d63617
commit
0b22ea5604
4 changed files with 20 additions and 4 deletions
2
README
2
README
|
@ -46,6 +46,8 @@ on a local network or multiple encodings on the same host.
|
||||||
|
|
||||||
to do this you need to install additional dependencies:
|
to do this you need to install additional dependencies:
|
||||||
apt-get install python-twisted python-requests
|
apt-get install python-twisted python-requests
|
||||||
|
(on ubuntu 12.04 you need a newer version of requests,
|
||||||
|
i.e: sudo easy_install -U requests)
|
||||||
|
|
||||||
now run one node in server mode:
|
now run one node in server mode:
|
||||||
pandora_client server
|
pandora_client server
|
||||||
|
|
|
@ -18,12 +18,16 @@ import pandora_client
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
usage = "usage: %prog [options] action"
|
usage = "usage: %prog [options] action"
|
||||||
parser = OptionParser(usage=usage)
|
parser = OptionParser(usage=usage)
|
||||||
|
parser.add_option('-v', '--version', dest='version', action="store_true")
|
||||||
parser.add_option('-c', '--config', dest='config',
|
parser.add_option('-c', '--config', dest='config',
|
||||||
help='config.json containing config', default='~/.ox/client.json', type='string')
|
help='config.json containing config', default='~/.ox/client.json', type='string')
|
||||||
parser.add_option('-d', '--debug', dest='debug',
|
parser.add_option('-d', '--debug', dest='debug',
|
||||||
help='output debug information', action="store_true")
|
help='output debug information', action="store_true")
|
||||||
(opts, args) = parser.parse_args()
|
(opts, args) = parser.parse_args()
|
||||||
|
|
||||||
|
if opts.version:
|
||||||
|
print "%s %s" % (os.path.basename(sys.argv[0]), pandora_client.__version__)
|
||||||
|
sys.exit(0)
|
||||||
opts.config = os.path.expanduser(opts.config)
|
opts.config = os.path.expanduser(opts.config)
|
||||||
if (args and args[0] not in ('config', 'client') and not os.path.exists(opts.config)):
|
if (args and args[0] not in ('config', 'client') and not os.path.exists(opts.config)):
|
||||||
print 'no configuration found, run "%s config" or specify one with -c' % sys.argv[0]
|
print 'no configuration found, run "%s config" or specify one with -c' % sys.argv[0]
|
||||||
|
@ -31,7 +35,7 @@ if __name__ == '__main__':
|
||||||
|
|
||||||
if None in (opts.config, ):
|
if None in (opts.config, ):
|
||||||
parser.print_help()
|
parser.print_help()
|
||||||
sys.exit()
|
sys.exit(1)
|
||||||
|
|
||||||
actions = ('scan', 'sync', 'upload', 'extract', 'clean', 'cmd', 'import_srt')
|
actions = ('scan', 'sync', 'upload', 'extract', 'clean', 'cmd', 'import_srt')
|
||||||
config = ('config', 'add_volume')
|
config = ('config', 'add_volume')
|
||||||
|
|
|
@ -15,6 +15,7 @@ import socket
|
||||||
import sqlite3
|
import sqlite3
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
|
import pkg_resources
|
||||||
|
|
||||||
import ox
|
import ox
|
||||||
|
|
||||||
|
@ -24,7 +25,7 @@ import utils
|
||||||
|
|
||||||
DEBUG = False
|
DEBUG = False
|
||||||
|
|
||||||
__version__ = '0.2'
|
__version__ = pkg_resources.require("pandora_client")[0].version
|
||||||
|
|
||||||
socket.setdefaulttimeout(300)
|
socket.setdefaulttimeout(300)
|
||||||
CHUNK_SIZE = 1024*1024
|
CHUNK_SIZE = 1024*1024
|
||||||
|
|
13
setup.py
13
setup.py
|
@ -8,13 +8,22 @@ except:
|
||||||
|
|
||||||
def get_bzr_version():
|
def get_bzr_version():
|
||||||
import os
|
import os
|
||||||
|
import re
|
||||||
info = os.path.join(os.path.dirname(__file__), '.bzr/branch/last-revision')
|
info = os.path.join(os.path.dirname(__file__), '.bzr/branch/last-revision')
|
||||||
|
changelog = os.path.join(os.path.dirname(__file__), 'debian/changelog')
|
||||||
if os.path.exists(info):
|
if os.path.exists(info):
|
||||||
f = open(info)
|
f = open(info)
|
||||||
rev = int(f.read().split()[0])
|
rev = int(f.read().split()[0])
|
||||||
f.close()
|
f.close()
|
||||||
if rev:
|
if rev:
|
||||||
return u'%s' % rev
|
return u'%s' % rev
|
||||||
|
elif os.path.exists(changelog):
|
||||||
|
f = open(changelog)
|
||||||
|
head = f.read().strip().split('\n')[0]
|
||||||
|
f.close()
|
||||||
|
rev = re.compile('\d+\.\d+\.(\d+)').findall(head)
|
||||||
|
if rev:
|
||||||
|
return u"%s" % rev[0]
|
||||||
return u'unknown'
|
return u'unknown'
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
|
@ -36,7 +45,8 @@ It is currently known to work on Linux and Mac OS X.
|
||||||
'pandora_client'
|
'pandora_client'
|
||||||
],
|
],
|
||||||
install_requires=[
|
install_requires=[
|
||||||
'ox >= 2.1.541'
|
'ox >= 2.1.541',
|
||||||
|
'requests >= 1.1.0'
|
||||||
],
|
],
|
||||||
keywords = [
|
keywords = [
|
||||||
],
|
],
|
||||||
|
@ -46,4 +56,3 @@ It is currently known to work on Linux and Mac OS X.
|
||||||
'License :: OSI Approved :: GNU General Public License (GPL)',
|
'License :: OSI Approved :: GNU General Public License (GPL)',
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue