configuration script done. ready to rc2

This commit is contained in:
Sameer Rahmani 2014-03-16 01:30:46 +03:30
parent af4c1f638f
commit 57e3cc774b
9 changed files with 215 additions and 1 deletions

41
config.sh Executable file
View File

@ -0,0 +1,41 @@
#! /usr/bin/env bash
. ./scripts/check_dep.sh
echo " _ __ ___ ___ ___ ";
echo " | |/ / _ ___ ___ |_ _| \| __|";
echo " | ' < || (_-</ _ \ | || |) | _| ";
echo " |_|\_\_,_/__/\___/ |___|___/|___|";
echo " ";
check_dep 'emacs' '' `emacs --version | head -n 1 | cut -d " " -f 3` '24.3'
check_dep 'git' 'On Debian you can install git by installing "git-core" package.'
check_dep 'bzr' 'On Debian you can install bzr by installing "bzr" package.'
check_dep 'makeinfo' 'On Debian you can install makeinfo by installing "texinfo" package.'
check_dep 'python' 'You need to install it from your package manager or from source'
check_dep 'pep8' 'Install it using "pip" or "easy_install"'
check_dep 'pyflakes' 'Install it using "pip" or "easy_install"'
check_dep 'pychecker' 'Install it using "pip" or "easy_install"'
check_dep 'pylint' 'Install it using "pip" or "easy_install"'
py_check_dep 'jedi' 'Install it using "pip" or "easy_install"' `python ./scripts/pypackage.py jedi`
py_check_dep 'epc' 'Install it using "pip" or "easy_install"' `python ./scripts/pypackage.py epc`
check_dep 'csscapture' 'Install it using "pip cssutils" or "easy_install cssutils"'
check_dep 'csscombine' 'Install it using "pip cssutils" or "easy_install cssutils"'
check_dep 'cssparse' 'Install it using "pip cssutils" or "easy_install cssutils"'
check_dep 'ruby' 'You need to install it from your package manager or from source'
check_dep 'rake' 'Install it using "gem install rake"'
check_dep 'bundle' 'Install it using "gem install bundler"'
check_dep 'xmlstarlet' 'On Debian you can install xmlstarlet by installing "xmlstarlet" package.'
check_dep 'csslint' 'For installing csslint you need "nodejs". You can install "csslint" via "npm"'
do_make
do_install

View File

@ -114,7 +114,7 @@ fi
if [ -e $conffile ]
then
info "Copying init files . . . "
info "Copying init files . . . "
cp $conffile $dotemacs
cp bin/$executable $repo/$executable
else

0
kuso Executable file
View File

54
scripts/check_dep.sh Normal file
View File

@ -0,0 +1,54 @@
. scripts/versioncmp.sh
. scripts/log.sh
function check_dep() {
local package=$1
local hint=$2
local version=$3
local version_to_check=$4
if [ $package ]
then
if hash $package 2>/dev/null; then
if [ "$version" ]
then
version_cmp $version $version_to_check
#python ./scripts/versioncmp.py $version $version_to_check
local cmp=$?
if [ "$cmp" == "2" ]
then
error "$package version $version_to_check required. Yours is $version"
info "$hint"
else
info "$package version $version is fine. need ($version_to_check)"
fi
else
info "Found $package"
fi
else
error "Can't find '$package'."
info "$hint"
fi
else
error "first argument is empty"
fi
}
function py_check_dep() {
local package=$1
local hint=$2
local existance=$3
if [ "$existance" == "1" ]
then
info "$package version $version is fine. need ($version_to_check)"
else
error "Can't find python package '$package'."
info "$hint"
fi
}

23
scripts/log.sh Normal file
View File

@ -0,0 +1,23 @@
#! /usr/bin/env bash
# Coloring Functions
function info() {
if [ "$1" ]
then
echo -e "[\033[01;32mINFO\033[00m]: $1"
fi
}
function error(){
if [ "$1" ]
then
echo -e "[\033[01;31mERR\033[00m]: $1"
fi
}
function warn(){
if [ "$1" ]
then
echo -e "[\033[01;33mWARN\033[00m]: $1"
fi
}

13
scripts/pypackage.py Normal file
View File

@ -0,0 +1,13 @@
import sys
def check_for_package(pkg):
try:
__import__(pkg, globals(), locals(), [], -1)
print "1"
except ImportError:
print "0"
if __name__ == "__main__":
check_for_package(sys.argv[1])

14
scripts/versioncmp.py Executable file
View File

@ -0,0 +1,14 @@
import sys
from distutils.version import LooseVersion
def version_cmp(ver1, ver2):
print ">>>> ", ver1, ver2
if LooseVersion(ver1) < LooseVersion(ver2):
print 1
else:
print 0
if __name__ == "__main__":
version_cmp(sys.argv[1], sys.argv[2])

56
scripts/versioncmp.sh Normal file
View File

@ -0,0 +1,56 @@
#!/bin/bash
# Copyright (c) 2012 Yu-Jie Lin
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# the Software without restriction, including without limitation the rights to
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
# of the Software, and to permit persons to whom the Software is furnished to do
# so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
VER_SPLIT_SED='s/\./ /g;s/\([[:digit:]]\)\([^[:digit:] ]\)/\1 \2/g;s/\([^[:digit:] ]\)\([[:digit:]]\)/\1 \2/g'
# Compare with one element of version components
_ver_cmp_1() {
[[ "$1" = "$2" ]] && return 0
if [[ -z "${1//[[:digit:]]/}" ]] && [[ -z "${2//[[:digit:]]/}" ]]; then
# Both $1 and $2 are numbers
# Using arithmetic comparison
(( $1 > $2 )) && return 1
(( $1 < $2 )) && return 2
else
# Either or both are not numbers, containing non-digit characters
# Using string comparison
[[ "$1" > "$2" ]] && return 1
[[ "$1" < "$2" ]] && return 2
fi
# This should not be happening
exit 1
}
version_cmp() {
local A B i result
A=($(sed "$VER_SPLIT_SED" <<< "$1"))
B=($(sed "$VER_SPLIT_SED" <<< "$2"))
i=0
while (( i < ${#A[@]} )) && (( i < ${#B[@]})); do
_ver_cmp_1 "${A[i]}" "${B[i]}"
result=$?
[[ $result =~ [12] ]] && return $result
let i++
done
# Which has more, then it is the newer version
_ver_cmp_1 "${#A[i]}" "${#B[i]}"
return $?
}

13
share/Kuso.desktop Normal file
View File

@ -0,0 +1,13 @@
[Desktop Entry]
Encoding=UTF-8
Name=Kuso
GenericName=Kuso IDE
Comment=An Emacs base IDE for emacs lovers.
MimeType=text/x-makefile;text/x-c++hdr;text/x-c++src;text/x-java;application/x-shellscript;text/x-c;text/x-c++;text/x-ruby;text/x-python;
Type=Application
Terminal=false
Categories=Development;TextEditor;
StartupWMClass=Kuso
Exec=--PATH--/kuso %F
Icon=--PATH--/share/kuso.tiff
Version=--VERSION--