You are not logged in.
Pages: 1
I'm in the middle of creating a package and would like some info on how to do things the right way.
The package was written in Python2 and thus if you try and run it, it will die.
I have worked around this by renaming python (run python file) to python2 (run python file) in the executable.
This can be easily done with sed in the final PKGBUILD file, but is this the correct way to do this?
Offline
No you're gonna break everything that expects python to be python3. Perhaps post your PKGBUILD but most pure Python packages are installed with
python setup.py installyou'd use python2 in place of python.
Last edited by Anikom15 (2011-02-18 18:32:29)
Personally, I'd rather be back in Hobbiton.
Offline
Okay, give me till tomorrow and I'll post the PKGBUILD as it is, still need to do a few things here and there.
In the mean time, this is what I was talking about:
# Make it python2 compatible on a python3 system
sed -i 's/python/python2/g' /usr/bin/bibleanalyzer
sed -i 's/python/python2/g' /usr/share/applications/bibleanalyzer.desktopThis changes things from this:
#!/bin/bash
clear
echo "************ Starting Bible Analyzer *************"
python /usr/share/bibleanalyzer/analyzer4.py
echo
read -p "Press Enter to close terminal"to this
#!/bin/bash
clear
echo "************ Starting Bible Analyzer *************"
python2 /usr/share/bibleanalyzer/analyzer4.py
echo
read -p "Press Enter to close terminal"Last edited by MW (2011-02-18 18:45:01)
Offline
Here is the PKGBUILD
This is the first time I have done something like this, so if there are a few improvements to be made, please share it.
# Contributor: Timothy Morton <xxxxx@bibleanalyzer.com>
# Maintainer: MyWorld <xxxxx@gmail.com>
pkgname=bibleanalyzer
pkgver=4.1_0
pkgrel=1
pkgdesc="A cross platform Bible study software program."
url="http://www.bibleanalyzer.com"
license="Custom"
arch=('i686' 'x86_64')
depends=('wxpython' 'python-espeak' 'python-configobj')
makedepends=('deb2targz')
source=(http://www.bibleanalyzer.com/${pkgname}_${pkgver//_/-}_i386.deb)
md5sums=('4d3ffb131220cd2db1cf514b9384515b')
build() {
# Convert the file
deb2targz ${srcdir}/${pkgname}_${pkgver//_/-}_i386.deb || exit 1
# Extract the file
tar xvzf ${srcdir}/${pkgname}_${pkgver//_/-}_i386.tar.gz -C / || exit 1
# Make it python2 compatible on a python3 system
sed -i 's/python/python2/g' /usr/bin/bibleanalyzer
sed -i 's/python/python2/g' /usr/share/applications/bibleanalyzer.desktop
# Create the directories required
(
echo -n "Creating directories as required: "
entries=`wc -l /etc/passwd | awk '{print $1}'`
declare -a luser[$entries]
for i in `seq 1 $entries`; do
username[$i]=`cat /etc/passwd | sed -n "${i}p" | awk -F: '{print $1}'`
groupid[$i]=`cat /etc/passwd | sed -n "${i}p" | awk -F: '{print $4}'`
if [ "${groupid[$i]}" == "100" ]; then
if [ -d /home/${username[$i]} ]; then
echo "${username[$i]} "
if [ ! -d /home/${username[$i]}/Documents/BibleAnalyzer ]; then
mkdir -p /home/${username[$i]}/Documents/BibleAnalyzer
fi
chown -R ${username[$i]}:users /home/${username[$i]}/Documents/BibleAnalyzer
fi
fi
done
echo
)
}Last edited by MW (2011-02-19 13:14:20)
Offline
Modifying a users home directory is very bad practice.
Offline
Modifying a users home directory is very bad practice.
Thank you for the reply!
The obvious thing then to do is to echo the necessary steps after the install finished?
I cannot find anything on this in the documentation, is a coloured echo allowed in a PKGBUILD?
# Contributor: Timothy Morton <morton@bibleanalyzer.com>
# Maintainer: MyWorld <mywereld@gmail.com>
pkgname=bibleanalyzer
pkgver=4.1_0
pkgrel=1
pkgdesc="A cross platform Bible study software program."
url="http://www.bibleanalyzer.com"
license="Custom"
arch=('i686' 'x86_64')
depends=('wxpython' 'python-espeak' 'python-configobj')
makedepends=('deb2targz')
source=(http://www.bibleanalyzer.com/${pkgname}_${pkgver//_/-}_i386.deb)
md5sums=('4d3ffb131220cd2db1cf514b9384515b')
build() {
cd ${srcdir}
# Convert the file
deb2targz ${pkgname}_${pkgver//_/-}_i386.deb || exit 1
# Extract the file
tar xvzf ${pkgname}_${pkgver//_/-}_i386.tar.gz -C / || exit 1
# Make it python2 compatible on a python3 system
sed -i 's/python/python2/g' /usr/bin/bibleanalyzer
sed -i 's/python/python2/g' /usr/share/applications/bibleanalyzer.desktop
# Create the directories required
echo -en '\E[01;31m'"\033[1m
For the program to run you need to create the following directory:
mkdir -p /home/[user]/Documents/BibleAnalyzer
\033[0m"
echo
}Last edited by MW (2011-02-19 20:17:40)
Offline
Generally speaking, the program will create the necessary directories at runtime. Doesn't the program do this?
Offline
No, unfortunately not. But I could speak to the author and hear if he could add this feature.
Offline
You could copy those files to /etc/skel instead of /home/whatever and add an .install file afterwards telling the user to copy over his stuff.
I find software that does not create it's own settings on runtime disturbing.
Offline
You could copy those files to /etc/skel instead of /home/whatever and add an .install file afterwards telling the user to copy over his stuff.
I find software that does not create it's own settings on runtime disturbing.
Sorry for being such a n00b...
We are ironing out the bugs as we go along, the errors in creating the directories seem to stem from the fact that the package was developed on Ubuntu.
The program stores all it's userfiles in ~/Documents/BibleAnalyzer, and Ubuntu creates the Documents folder upon installation and the application creates the latter on first run. Other distros however do not follow the same standards so the author needs to implement a check for both the Documents AND BibleAnalyzer folders.
I have asked the author to look into this and it should be fixed momentarily, thanks for the input!
Offline
Perhaps the authors could follow the standards
http://standards.freedesktop.org/basedi … 01s03.html
Online
There's a Documents folder standard?
Personally, I'd rather be back in Hobbiton.
Offline
Pages: 1