diff --git a/README b/README index 7bde23c..3f53819 100644 --- a/README +++ b/README @@ -3,15 +3,14 @@ Kirmah 2.18 (2013-05-15) Install on Archlinux ------------------------- -sudo pacman -U http://sourceforge.net/projects/kirmah/files/packages/archlinux/kirmah-2.18-1-any.pkg.tar.xz/download - +sudo pacman -U http://sourceforge.net/projects/kirmah/files/kirmah-2.18/packages/archlinux/kirmah-2.18-1-any.pkg.tar.xz/download (re)build instruction ------------------------- mkdir /tmp/kirmah; cd /tmp/kirmah; -wget http://sourceforge.net/projects/kirmah/files/packages/archlinux/PKGBUILD/download +wget http://sourceforge.net/projects/kirmah/files/kirmah-2.18/packages/archlinux/PKGBUILD/download mv download PKGBUILD -wget http://sourceforge.net/projects/kirmah/files/packages/archlinux/kirmah.install/download +wget http://sourceforge.net/projects/kirmah/files/kirmah-2.18/packages/archlinux/kirmah.install/download mv download kirmah.install makepkg -s; @@ -24,4 +23,4 @@ simply untar archive, then launch : $ python ./kirmah/kirmah.py $ python ./kirmah/kirmah-cli.py -you can also use python2 disutils and setup.py +you can also use python disutils and setup.py diff --git a/kirmah-cli.py b/kirmah-cli.py index b61e15a..540bd5e 100644 --- a/kirmah-cli.py +++ b/kirmah-cli.py @@ -1,5 +1,5 @@ -# !/usr/bin/env python -# -*- coding: utf-8 -*- +#!/usr/bin/env python3 +#-*- coding: utf-8 -*- # kirmah-cli.py # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # diff --git a/kirmah.py b/kirmah.py index 8de4303..ad75468 100644 --- a/kirmah.py +++ b/kirmah.py @@ -1,5 +1,5 @@ -# !/usr/bin/env python3 -# -*- coding: utf-8 -*- +#!/usr/bin/env python3 +#-*- coding: utf-8 -*- # kirmah.py # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # diff --git a/kirmah/app.py b/kirmah/app.py index f5c013b..ed51976 100644 --- a/kirmah/app.py +++ b/kirmah/app.py @@ -1,5 +1,5 @@ -# !/usr/bin/env python -# -*- coding: utf-8 -*- +#!/usr/bin/env python3 +#-*- coding: utf-8 -*- # kirmah.app.py # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # diff --git a/kirmah/cli.py b/kirmah/cli.py index e29435d..478f9af 100755 --- a/kirmah/cli.py +++ b/kirmah/cli.py @@ -1,5 +1,5 @@ -# !/usr/bin/env python -# -*- coding: utf-8 -*- +#!/usr/bin/env python3 +#-*- coding: utf-8 -*- # kirmah.cli.py # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # diff --git a/kirmah/cliapp.py b/kirmah/cliapp.py index 57aeafc..87a12aa 100755 --- a/kirmah/cliapp.py +++ b/kirmah/cliapp.py @@ -1,5 +1,5 @@ -# !/usr/bin/env python -# -*- coding: utf-8 -*- +#!/usr/bin/env python3 +#-*- coding: utf-8 -*- # kirmah/cliapp.py # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # diff --git a/kirmah/conf.py b/kirmah/conf.py index f0205b9..0881656 100755 --- a/kirmah/conf.py +++ b/kirmah/conf.py @@ -1,5 +1,5 @@ -# !/usr/bin/env python -# -*- coding: utf-8 -*- +#!/usr/bin/env python3 +#-*- coding: utf-8 -*- # kirmah/conf.py # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # @@ -33,7 +33,7 @@ from getpass import getuser as getUserLogin from os import sep -from os.path import dirname, realpath +from os.path import dirname, realpath, isdir, join PRG_NAME = 'Kirmah' PRG_PACKAGE = PRG_NAME.lower() @@ -45,18 +45,14 @@ PRG_COPY = 'pluie.org' PRG_YEAR = '2013' PRG_WEBSITE = 'http://kirmah.sourceforge.net' PRG_LICENSE = 'GNU GPL v3' -PRG_RESOURCES_PATH = '/usr/share/pixmaps/'+PRG_PACKAGE+'/' -try: - with open(PRG_RESOURCES_PATH) as f: - pass -except IOError as e: - PRG_RESOURCES_PATH = dirname(dirname(realpath(__file__)))+sep+'resources'+sep - pass +PRG_RESOURCES_PATH = '/usr/share/'+PRG_PACKAGE+sep +if not isdir(PRG_RESOURCES_PATH): + PRG_RESOURCES_PATH = dirname(dirname(realpath(__file__)))+sep+'resources'+sep+PRG_PACKAGE+sep print(PRG_RESOURCES_PATH) -PRG_GLADE_PATH = PRG_RESOURCES_PATH+PRG_PACKAGE+sep+'glade'+sep+PRG_PACKAGE+'.glade' -PRG_LICENSE_PATH = PRG_RESOURCES_PATH+PRG_PACKAGE+'/LICENSE' -PRG_LOGO_PATH = PRG_RESOURCES_PATH+'pixmaps'+sep+PRG_PACKAGE+sep+PRG_PACKAGE+'.png' -PRG_LOGO_ICON_PATH = PRG_RESOURCES_PATH+'pixmaps'+sep+PRG_PACKAGE+sep+PRG_PACKAGE+'_ico.png' +PRG_GLADE_PATH = PRG_RESOURCES_PATH+'glade'+sep+PRG_PACKAGE+'.glade' +PRG_LICENSE_PATH = PRG_RESOURCES_PATH+'/LICENSE' +PRG_LOGO_PATH = join(PRG_RESOURCES_PATH,'..'+sep,'pixmaps'+sep,PRG_PACKAGE+sep,PRG_PACKAGE+'.png') +PRG_LOGO_ICON_PATH = join(PRG_RESOURCES_PATH,'..'+sep,'pixmaps'+sep,PRG_PACKAGE+sep,PRG_PACKAGE+'_ico.png') PRG_ABOUT_LOGO_SIZE = 160 PRG_ABOUT_COPYRIGHT = '(c) '+PRG_AUTHOR+' - '+PRG_COPY+' '+PRG_YEAR PRG_ABOUT_COMMENTS = ''.join(['Kirmah simply encrypt/decrypt files','\n', 'license ',PRG_LICENSE]) diff --git a/kirmah/crypt.py b/kirmah/crypt.py index b6ec3fb..8b1a9c0 100755 --- a/kirmah/crypt.py +++ b/kirmah/crypt.py @@ -1,5 +1,5 @@ -# !/usr/bin/env python -# -*- coding: utf-8 -*- +#!/usr/bin/env python3 +#-*- coding: utf-8 -*- # kirmah/crypt.py # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # diff --git a/kirmah/gui.py b/kirmah/gui.py index bef588b..94e16f8 100644 --- a/kirmah/gui.py +++ b/kirmah/gui.py @@ -1,5 +1,5 @@ -# !/usr/bin/env python -# -*- coding: utf-8 -*- +#!/usr/bin/env python3 +#-*- coding: utf-8 -*- # kirmah.gui.py # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # diff --git a/kirmah/kctrl.py b/kirmah/kctrl.py deleted file mode 100755 index 9f51ef1..0000000 --- a/kirmah/kctrl.py +++ /dev/null @@ -1,111 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # -# # -# software : Kirmah # -# version : 2.1 # -# date : 2013 # -# licence : GPLv3.0 # -# author : a-Sansara # -# copyright : pluie.org # -# # -# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # -# -# This file is part of Kirmah. -# -# Kirmah is free software (free as in speech) : 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. -# -# Kirmah 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 Kirmah. If not, see . - - -from gi.repository.GObject import timeout_add -from psr.sys import Sys -from psr.mproc import Ctrl -from psr.decorate import log -from kirmah.crypt import Kirmah, ConfigKey, KeyGen, b2a_base64, a2b_base64, hash_sha256 - - -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# ~~ class KCtrl ~~ - -class KCtrl(Ctrl): - - @log - def encrypt(self, fromPath, toPath, km, header=None, callback=None, timeout=50): - """""" - self.tstart = Sys.datetime.now() - self.km = km - self.callback = callback - self.fromPath = fromPath - self.toPath = toPath - - if Sys.g.DEBUG : Sys.pcontent(' Encrypting file : '+self.fromPath+' ('+Sys.getFileSize(self.fromPath)+') by '+str(self.nproc)+' process') - if self.nproc < 2: - self.km.encrypt(self.fromPath, self.toPath, header) - self.on_end_mpenc() - else : - self.ppid = Sys.getpid() - self.fp, self.tp, self.rmode, self.mmode, self.compend = self.km.encrypt_sp_start(fromPath, toPath, header) - self.hsltPaths = self.km.prepare_mproc_encode(self.fp, self.nproc) - self.bind_task(self.mpenc) - self.start(timeout, None, self.on_end_mpenc) - - @log - def decrypt(self, fromPath, toPath, km, callback=None, timeout=50): - """""" - self.tstart = Sys.datetime.now() - self.km = km - self.callback = callback - self.fromPath = fromPath - self.toPath = toPath - self.ppid = Sys.getpid() - if Sys.g.DEBUG : Sys.pcontent(' Decrypting file : '+self.fromPath+' ('+Sys.getFileSize(self.fromPath)+') by '+str(self.nproc)+' process') - if self.nproc < 2: - self.decrypt(fromPath, toPath) - self.on_end_mpdec() - else : - self.fp, self.tp, self.compstart = self.km.decrypt_sp_start(fromPath, toPath) - self.hsltPaths = self.km.prepare_mproc_decode(self.fp, self.nproc) - self.bind_task(self.mpdec) - self.start(50, None, self.on_end_mpdec) - - #~ @log - def getSubStartIndice(self, id): - """""" - return sum([ len(x) for j, x in enumerate(self.data) if j < id ])%len(self.km.key) - - @log - def mpenc(self, id): - """""" - self.km.mproc_encode_part(id, self.ppid) - - @log - def mpdec(self, id): - """""" - self.km.mproc_decode_part(id, self.ppid) - - @log - def on_end_mpdec(self): - """""" - if self.nproc > 1 : - self.km.mpMergeFiles(self.hsltPaths, self.tp) - self.km.decrypt_sp_end(self.tp, self.toPath, self.compstart) - if self.callback is not None : self.callback(self.tstart, True) - - @log - def on_end_mpenc(self): - """""" - if self.nproc > 1 : - self.km.mpMergeFiles(self.hsltPaths, self.tp) - self.fp, self.tp = self.tp, self.km.tmpPath2 if self.tp == self.km.tmpPath1 else self.km.tmpPath1 - self.km.encrypt_sp_end(self.fp, self.tp, self.toPath, self.rmode, self.mmode, self.compend) - if self.callback is not None : self.callback(self.tstart, True) diff --git a/kirmah/ui.py b/kirmah/ui.py index 4e83eea..c814869 100644 --- a/kirmah/ui.py +++ b/kirmah/ui.py @@ -1,5 +1,5 @@ -# !/usr/bin/env python -# -*- coding: utf-8 -*- +#!/usr/bin/env python3 +#-*- coding: utf-8 -*- # kirmah/ui.py # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # diff --git a/pkgbuild/PKGBUILD b/pkgbuild/PKGBUILD new file mode 100755 index 0000000..ea6a0e3 --- /dev/null +++ b/pkgbuild/PKGBUILD @@ -0,0 +1,23 @@ +# Maintainer : a-Sansara <[a-sansara]at[clochardprod]dot[net]> +# Contributor : +pkgname=kirmah +pkgver=2.18 +pkgrel=1 +pkgdesc='Encryption with symmetric-key algorithm Kirmah. cli tool and gtk+ GUI front-end' +arch=('any') +url='https://sourceforge.net/projects/kirmah/' +license=('GPL3') +depends=('python3' 'python-gobject' 'gobject-introspection' 'pygtk' 'desktop-file-utils') +install="${pkgname}.install" +source=("http://download.pluie.org/packages/archlinux/${pkgname}-${pkgver}.tar.bz2") +md5sums=('aa396a5dc79adfe8d2dfcb041d834dfa') + +build() { + cd "${srcdir}/${pkgname}" + python3 setup.py build +} + +package() { + cd "${srcdir}/${pkgname}" + python3 setup.py install --root="${pkgdir}" --prefix=/usr --optimize=1 +} diff --git a/pkgbuild/kirmah.install b/pkgbuild/kirmah.install new file mode 100755 index 0000000..0da09b5 --- /dev/null +++ b/pkgbuild/kirmah.install @@ -0,0 +1,12 @@ +post_install() { + update-desktop-database -q +} + +post_upgrade() { + post_install $1 +} + +post_remove() { + post_install $1 + echo "you should mannually remove /home/$USER/.kirmah" +} diff --git a/psr/cli.py b/psr/cli.py index bba0162..f05057b 100644 --- a/psr/cli.py +++ b/psr/cli.py @@ -1,5 +1,5 @@ -# !/usr/bin/env python -# -*- coding: utf-8 -*- +#!/usr/bin/env python3 +#-*- coding: utf-8 -*- # kirmah.cli.py # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # diff --git a/psr/const.py b/psr/const.py index 9398699..9c8b259 100644 --- a/psr/const.py +++ b/psr/const.py @@ -1,5 +1,5 @@ -# !/usr/bin/env python -# -*- coding: utf-8 -*- +#!/usr/bin/env python3 +#-*- coding: utf-8 -*- # psr/const.py # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # diff --git a/psr/io.py b/psr/io.py index fbef095..a054ab4 100644 --- a/psr/io.py +++ b/psr/io.py @@ -1,5 +1,5 @@ -# !/usr/bin/env python -# -*- coding: utf-8 -*- +#!/usr/bin/env python3 +#-*- coding: utf-8 -*- # psr/io.py # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # diff --git a/psr/log.py b/psr/log.py index b266fb2..4dd7393 100644 --- a/psr/log.py +++ b/psr/log.py @@ -1,5 +1,5 @@ -# !/usr/bin/env python -# -*- coding: utf-8 -*- +#!/usr/bin/env python3 +#-*- coding: utf-8 -*- # psr/log.py # # # # # # # # # # # # # # # # # # # # # # # # # diff --git a/psr/mproc.py b/psr/mproc.py index 27c5d0c..6daaaf8 100644 --- a/psr/mproc.py +++ b/psr/mproc.py @@ -1,5 +1,5 @@ -# !/usr/bin/env python -# -*- coding: utf-8 -*- +#!/usr/bin/env python3 +#-*- coding: utf-8 -*- # psr/mproc.py # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # diff --git a/psr/sys.py b/psr/sys.py index 23c5e21..6aa1f1b 100644 --- a/psr/sys.py +++ b/psr/sys.py @@ -1,5 +1,5 @@ -# !/usr/bin/env python -# -*- coding: utf-8 -*- +#!/usr/bin/env python3 +#-*- coding: utf-8 -*- # psr/sys.py # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # diff --git a/psr/w32color.py b/psr/w32color.py index a1c6e53..0afc865 100644 --- a/psr/w32color.py +++ b/psr/w32color.py @@ -1,5 +1,5 @@ -# !/usr/bin/env python -# -*- coding: utf-8 -*- +#!/usr/bin/env python3 +#-*- coding: utf-8 -*- # psr/w32color.py # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # diff --git a/resources/kirmah.desktop b/resources/kirmah.desktop index c880428..f1cab32 100644 --- a/resources/kirmah.desktop +++ b/resources/kirmah.desktop @@ -3,7 +3,7 @@ Name=Kirmah Comment=Encryption with symmetric-key algorithm Kirmah Version=0.34 -Icon=kirmah +Icon=/usr/share/pixmaps/kirmah/kirmah.png Exec=kirmah Terminal=false Type=Application diff --git a/scripts/kirmah b/scripts/kirmah new file mode 100644 index 0000000..ad75468 --- /dev/null +++ b/scripts/kirmah @@ -0,0 +1,45 @@ +#!/usr/bin/env python3 +#-*- coding: utf-8 -*- +# kirmah.py +# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # +# +# software : Kirmah +# version : 2.17 +# date : 2013 +# licence : GPLv3.0 +# author : a-Sansara <[a-sansara]at[clochardprod]dot[net]> +# copyright : pluie.org +# +# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # +# +# This file is part of Kirmah. +# +# Kirmah is free software (free as in speech) : 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. +# +# Kirmah 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 Kirmah. If not, see . +# + +from psr.sys import Sys, Const +from kirmah.gui import AppGui + +def main(): + try: + c = 0 + AppGui() + except Exception as e: + Sys.pwarn((('main : ',(str(e),Sys.CLZ_ERROR_PARAM), ' !'),), True) + #~ raise e + c = 1 + return c + +if __name__ == '__main__': + Sys.exit(main()) diff --git a/scripts/kirmah-cli b/scripts/kirmah-cli new file mode 100644 index 0000000..540bd5e --- /dev/null +++ b/scripts/kirmah-cli @@ -0,0 +1,45 @@ +#!/usr/bin/env python3 +#-*- coding: utf-8 -*- +# kirmah-cli.py +# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # +# +# software : Kirmah +# version : 2.18 +# date : 2013 +# licence : GPLv3.0 +# author : a-Sansara <[a-sansara]at[clochardprod]dot[net]> +# copyright : pluie.org +# +# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # +# +# This file is part of Kirmah. +# +# Kirmah is free software (free as in speech) : 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. +# +# Kirmah 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 Kirmah. If not, see . +# + +from psr.sys import Sys, Const +from kirmah.cli import Cli + +def main(): + try: + c = 0 + Cli('.'+Sys.sep) + except Exception as e : + Sys.pwarn((('main : ',(str(e),Sys.CLZ_ERROR_PARAM), ' !'),), True) + #~ raise e + c = 1 + return c + +if __name__ == '__main__': + Sys.exit(main()) diff --git a/setup.py b/setup.py index bf11236..db12686 100644 --- a/setup.py +++ b/setup.py @@ -1,5 +1,5 @@ -# !/usr/bin/env python -# -*- coding: utf-8 -*- +#!/usr/bin/env python3 +#-*- coding: utf-8 -*- # setup.py # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # @@ -28,7 +28,7 @@ # along with Kirmah. If not, see . # -from psr.kirmah import conf +from kirmah import conf from distutils.core import setup import glob import os @@ -43,8 +43,8 @@ for filepath in glob.glob('resources/locale/*/LC_MESSAGES/*.mo'): setup(name = conf.PRG_NAME, version = conf.PRG_VERS, - packages = [conf.PRG_PACKAGE], - scripts = [conf.PRG_SCRIPT, conf.PRG_CLI_NAME], + packages = [conf.PRG_PACKAGE, 'psr'], + scripts = ['scripts/'+conf.PRG_SCRIPT, 'scripts/'+conf.PRG_CLI_NAME], data_files= [('/usr/share/pixmaps/'+conf.PRG_PACKAGE , glob.glob('resources/pixmaps/'+conf.PRG_PACKAGE+'/*.png')), ('/usr/share/applications' , ['resources/'+conf.PRG_PACKAGE+'.desktop']), ('/usr/share/'+conf.PRG_PACKAGE , glob.glob('resources/'+conf.PRG_PACKAGE+'/LICENSE')),