add cqlsh to Debian package

This commit is contained in:
paul cannon 2012-01-26 00:27:03 -06:00 committed by Eric Evans
parent 1387d92fcd
commit 8a5436a2b6
5 changed files with 51 additions and 10 deletions

View File

@ -47,6 +47,7 @@ import optparse
import ConfigParser
import codecs
import re
import platform
# cqlsh should run correctly when run out of a Cassandra source tree,
# out of an unpacked Cassandra tarball, and after a proper package install.
@ -66,16 +67,25 @@ except ImportError:
CQL_LIB_PREFIX = 'cql-internal-only-'
THRIFT_LIB_PREFIX = 'thrift-python-internal-only-'
# use bundled libs for python-cql and thrift, if available
ziplibdir = os.path.join(os.path.dirname(__file__), '..', 'lib')
cql_zips = glob(os.path.join(ziplibdir, CQL_LIB_PREFIX + '*.zip'))
if cql_zips:
cql_zip = cql_zips[0]
# use bundled libs for python-cql and thrift, if available. if there
# is a ../lib dir, use bundled libs there preferentially.
ZIPLIB_DIRS = [os.path.join(os.path.dirname(__file__), '..', 'lib')]
myplatform = platform.system()
if myplatform == 'Linux':
ZIPLIB_DIRS.append('/usr/share/cassandra/lib')
def find_zip(libprefix):
for ziplibdir in ZIPLIB_DIRS:
zips = glob(os.path.join(ziplibdir, libprefix + '*.zip'))
if zips:
return max(zips) # probably the highest version, if multiple
cql_zip = find_zip(CQL_LIB_PREFIX)
if cql_zip:
ver = os.path.splitext(os.path.basename(cql_zip))[0][len(CQL_LIB_PREFIX):]
sys.path.insert(0, os.path.join(cql_zip, 'cql-' + ver))
thrift_zips = glob(os.path.join(ziplibdir, THRIFT_LIB_PREFIX + '*.zip'))
if thrift_zips:
thrift_zip = thrift_zips[0]
thrift_zip = find_zip(THRIFT_LIB_PREFIX)
if thrift_zip:
sys.path.insert(0, thrift_zip)
try:

View File

@ -11,5 +11,7 @@ bin/json2sstable usr/bin
bin/sstable2json usr/bin
bin/sstablekeys usr/bin
bin/sstableloader usr/bin
bin/cqlsh usr/bin
lib/*.jar usr/share/cassandra/lib
lib/*.zip usr/share/cassandra/lib
lib/licenses usr/share/doc/cassandra

5
debian/control vendored
View File

@ -2,7 +2,8 @@ Source: cassandra
Section: misc
Priority: extra
Maintainer: Eric Evans <eevans@apache.org>
Build-Depends: debhelper (>= 5), openjdk-6-jdk (>= 6b11) | java6-sdk, ant (>= 1.7), ant-optional (>= 1.7), subversion
Uploaders: Sylvain Lebresne <slebresne@apache.org>
Build-Depends: debhelper (>= 5), openjdk-6-jdk (>= 6b11) | java6-sdk, ant (>= 1.7), ant-optional (>= 1.7), subversion, python-support
Homepage: http://cassandra.apache.org
Vcs-Svn: https://svn.apache.org/repos/asf/cassandra/trunk
Vcs-Browser: http://svn.apache.org/viewvc/cassandra/trunk
@ -10,7 +11,7 @@ Standards-Version: 3.8.3
Package: cassandra
Architecture: all
Depends: openjdk-6-jre-headless (>= 6b11) | java6-runtime, jsvc (>= 1.0), libcommons-daemon-java (>= 1.0), adduser, libjna-java
Depends: openjdk-6-jre-headless (>= 6b11) | java6-runtime, jsvc (>= 1.0), libcommons-daemon-java (>= 1.0), adduser, libjna-java, python (>= 2.5), python-support (>= 0.90.0), ${misc:Depends}
Conflicts: apache-cassandra1
Replaces: apache-cassandra1
Description: distributed storage system for structured data

4
debian/rules vendored
View File

@ -18,6 +18,7 @@ clean:
rm -rf bin/java
find -name "*.pyc" -exec rm '{}' ';'
find -name "*py.class" -exec rm '{}' ';'
$(RM) -r pylib/build
dh_clean
build: build-stamp
@ -26,6 +27,8 @@ build-stamp:
printf "version=%s" $(VERSION) > build.properties
$(ANT) jar
cd pylib && python setup.py install --no-compile --install-layout deb \
--root $(CURDIR)/debian/cassandra
touch build-stamp
@ -34,6 +37,7 @@ install: build
dh_testroot
dh_installdirs
dh_install
dh_pysupport
# Copy in the jar and symlink to something stable
dh_install build/apache-cassandra-$(VERSION).jar \

24
pylib/setup.py Executable file
View File

@ -0,0 +1,24 @@
#!/usr/bin/python
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from distutils.core import setup
setup(
name="cassandra-pylib",
description="Cassandra Python Libraries",
packages=["cqlshlib"],
)