Browse Source

Remove the old scripts

ep1
Sameer Rahmani 7 months ago
parent
commit
d75f69d53a
  1. 150
      scripts/check_dep.sh
  2. 20
      scripts/fg42-wm
  3. 35
      scripts/log.sh
  4. 72
      scripts/make_files.sh
  5. 39
      scripts/plugins.sh
  6. 31
      scripts/pypackage.py
  7. 1
      scripts/version.sh
  8. 14
      scripts/versioncmp.py
  9. 56
      scripts/versioncmp.sh

150
scripts/check_dep.sh

@ -1,150 +0,0 @@ @@ -1,150 +0,0 @@
# Copyright (c) 2014 lxsameer <lxsameer@gnu.org>
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation, either version 3 of the License, or (at your
# option) any later version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
# details.
# You should have received a copy of the GNU General Public License along with
# this program. If not, see http://www.gnu.org/licenses/.
. scripts/versioncmp.sh
. scripts/log.sh
required_packages=("emacs" "jedi" "epc" "ruby")
unmet_deps=()
function can_we_continue() {
local deps=()
local failed="0"
for elem in "${required_packages[@]}"
do
if [[ "${unmet_deps[*]}" == *"$elem"* ]]
then
deps+=($elem)
failed="1"
fi
done
if [ $failed == "1" ]
then
error "Can't continue. There are some requirements are missing:"
echo
for i in "${deps[@]}"
do
echo "$i"
done
echo
echo "Install them and retry please."
exit 1
fi
}
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"
unmet_deps+=($package)
else
echo "$package version $version is fine. need ($version_to_check)"
fi
else
echo "Found $package"
fi
else
error "Can't find '$package'."
info "$hint"
unmet_deps+=($package)
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
echo "Found $package"
else
error "Can't find python package '$package'."
info "$hint"
unmet_deps+=($package)
fi
}
function do_check() {
check_dep 'emacs' '' `emacs --version | head -n 1 | cut -d " " -f 3` '24.3'
echo ""
info "Check for DVCS's needed to install or update packages."
echo -e "\tIgnore errors if you don't want to install or update any package"
echo
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.'
if [[ "${selected_plugins[*]}" == *"kuso-python"* ]]
then
echo ""
info "Check for kuso-python dependencies. . ."
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"'
fi
if [[ "${selected_plugins[*]}" == *"kuso-ruby"* ]]
then
echo ""
info "Check for kuso-ruby dependencies. . ."
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 'rubocop' 'Install it using "gem install rubocop"'
fi
if [[ "${selected_plugins[*]}" == *"kuso-web"* ]]
then
echo ""
info "Check for kuso-web dependencies. . ."
check_dep 'xmlstarlet' 'On Debian you can install xmlstarlet by installing "xmlstarlet" package.'
check_dep 'jshint' 'For installing csslint you need "nodejs". You can install "jshint" via "npm"'
check_dep 'csslint' 'For installing csslint you need "nodejs". You can install "csslint" via "npm"'
fi
can_we_continue
}

20
scripts/fg42-wm

@ -1,20 +0,0 @@ @@ -1,20 +0,0 @@
#! /bin/sh
# Disable access control for the current user.
xhost +SI:localuser:$USER
# Make Java applications aware this is a non-reparenting window manager.
export _JAVA_AWT_WM_NONREPARENTING=1
# Set default cursor.
xsetroot -cursor_name left_ptr
# Set keyboard repeat rate.
xset r rate 400 30
$HOME/.xinitrc
# Uncomment the following block to use the exwm-xim module.
#export XMODIFIERS=@im=exwm-xim
#export GTK_IM_MODULE=xim
#export QT_IM_MODULE=xim
#export CLUTTER_IM_MODULE=xim

35
scripts/log.sh

@ -1,35 +0,0 @@ @@ -1,35 +0,0 @@
# Copyright (c) 2014 lxsameer <lxsameer@gnu.org>
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation, either version 3 of the License, or (at your
# option) any later version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
# details.
# You should have received a copy of the GNU General Public License along with
# this program. If not, see http://www.gnu.org/licenses/.
# 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
}

72
scripts/make_files.sh

@ -1,72 +0,0 @@ @@ -1,72 +0,0 @@
# Copyright (c) 2014 lxsameer <lxsameer@gnu.org>
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation, either version 3 of the License, or (at your
# option) any later version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
# details.
# You should have received a copy of the GNU General Public License along with
# this program. If not, see http://www.gnu.org/licenses/.
function pre_make() {
rm `find kuso.d -iname "*.elc"` 2> /dev/null
rm -R .build
rm ./kuso.config.el 2> /dev/null
mkdir -p `pwd`/.build/
mkdir .build/share
mkdir .build/conf
mkdir .build/bin
cp -r ./share/ .build/
cp -r ./conf/ .build/
cp -r ./bin/ .build/
}
function do_make() {
pre_make
#No such place
files=("conf/kuso.config.el" "bin/kuso")
read -p "Enter your full name: " fullname
read -p "Enter your email address: " mail
read -p "Where is your workspace directory[~/src/]: " workspace
current_path=`pwd`
plugins_list=${selected_plugins[@]}
# Validating informations
if [ "$workspace" == "" ]
then
workspace="$HOME/src/"
fi
for file in "${files[@]}"
do
cp $file ".build/$file"
sed -i '' -e "s|--EMAIL--|$mail|g" ".build/$file"
sed -i '' -e "s|--FULLNAME--|$fullname|g" ".build/$file"
sed -i '' -e "s|--WORKSPACE--|$workspace|g" ".build/$file"
sed -i '' -e "s|--REPO--|$repo|g" ".build/$file"
sed -i '' -e "s|--PATH--|$current_path|g" ".build/$file"
sed -i '' -e "s|--PLUGINS--|$plugins_list|g" ".build/$file"
sed -i '' -e "s|--VERSION--|$VERSION|g" ".build/$file"
done
post_make
}
function post_make() {
cp -r .build/conf/kuso.config.el ./
cp -r .build/bin/kuso ./
chmod +x ./kuso
# Byte compile everything
echo "Compiling elisp files ..."
emacs --batch --eval "(byte-recompile-directory \"./kuso.d/\" 0)" -Q -l kuso.config.el 2> ./build.log
}

39
scripts/plugins.sh

@ -1,39 +0,0 @@ @@ -1,39 +0,0 @@
# Copyright (c) 2014 lxsameer <lxsameer@gnu.org>
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation, either version 3 of the License, or (at your
# option) any later version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
# details.
# You should have received a copy of the GNU General Public License along with
# this program. If not, see http://www.gnu.org/licenses/.
function ask_for_plugins(){
# Ask user for plugins
plugins=("kuso-python" "kuso-ruby" "kuso-web")
echo
echo "Plugins:"
for plugin in "${plugins[@]}"
do
echo -e "\t$plugin"
done
echo -e "\tall"
echo
info "Enter the full name of plugins which you want to use with kuso or 'all'"
echo "to use all of them."
warn "Remember each plugin will consum startup process."
read -p "Plugins (separated by space)[defualt all]: " selected_plugins
if [ "$selected_plugins" == "" -o "$selected_plugins" == "all" ]
then
selected_plugins=( `IFS=$'\n'; echo "${plugins[*]}"` )
else
tmp=($selected_plugins)
selected_plugins=( `IFS=$'\n'; echo "${tmp[*]}"` )
fi
}

31
scripts/pypackage.py

@ -1,31 +0,0 @@ @@ -1,31 +0,0 @@
# Copyright (c) 2014 lxsameer <lxsameer@gnu.org>
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation, either version 3 of the License, or (at your
# option) any later version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
# details.
# You should have received a copy of the GNU General Public License along with
# this program. If not, see http://www.gnu.org/licenses/.
from __future__ import print_function
import sys
def check_for_package(pkg):
try:
try:
__import__(pkg, globals(), locals(), [], -1)
except ValueError:
__import__(pkg, globals(), locals(), [], 0)
print("1")
except ImportError:
print("0")
if __name__ == "__main__":
check_for_package(sys.argv[1])

1
scripts/version.sh

@ -1 +0,0 @@ @@ -1 +0,0 @@
VERSION="1.0.0-rc2"

14
scripts/versioncmp.py

@ -1,14 +0,0 @@ @@ -1,14 +0,0 @@
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

@ -1,56 +0,0 @@ @@ -1,56 +0,0 @@
#!/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 $?
}
Loading…
Cancel
Save