Originally Posted by
Umang
Hi,
I'm having the same problem. However, I don't like this hacky way of dealing with the problem. Because if they do fix the problem (and I have no idea why they haven't), then the files will start going back to /usr/ but we'll be reading it from /usr/local/.
Also, if you read this(
http://docs.python.org/distutils/set...ditional-files ), it says that the files will be installed relative to sys.prefix. That is not happening now. So I'm hesitant to put /usr/local directly if Python > 2.6.
This method will also render distutils useless to install the package on a non Unix OS.
Any further ideas?
(Sorry for reviving this old thread)
The way we got around it, we installed all the python module files to the default python module path, but moved all the extra files (bash scripts, glade files, icons, etc) to a specific folder in the "/usr/share" folder using static path declarations in the "setup.py" file and in the python module files that called those specific files.
For example, instead of this:
Code:
#!/usr/bin/env python
#########################################################################
## Import required modules
import os, sys, platform
from distutils.core import setup
## Get current Python version
python_version = platform.python_version_tuple()
## Setup the default install prefix
set_prefix = sys.prefix
## Check our python is version 2.6 or higher
if python_version[0] >= "2" and python_version[1] >= "6":
## Set file location prefix accordingly
set_prefix = '/usr/local'
## Get the install prefix if one is specified from the command line
for arg in sys.argv:
if arg.startswith('--prefix='):
prefix = arg[9:]
set_prefix = os.path.expandvars(prefix)
## Make sure people are using Python 2.5 or higher
if python_version[0] < "2" and python_version[1] < "5":
print "The installed version of Python is to old."
print "We require as a minimum Python 2.5.x."
sys.exit(1)
## Create the contents of the KernelCheck/constants.py file
const_file = open(os.path.join('KernelCheck', 'constants.py'), 'w')
const_file.write("KCHECK_PREFIX = '%s/share/kernelcheck/'\n" % set_prefix)
const_file.write("KCHECK_UI = KCHECK_PREFIX\n")
const_file.write("KCHECK_PIXMAPS = '%s/share/kernelcheck/pixmaps/'\n" % set_prefix)
const_file.write("KCHECK_SCRIPTS = '%s/share/kernelcheck/scripts/'\n\n" % set_prefix)
const_file.close()
## Update applications/kernelcheck.desktop file with new prefix
in_file = open(os.path.join('share', 'applications', 'kernelcheck.desktop.in'))
data = in_file.read().replace('@PREFIX@', set_prefix)
in_file.close()
out_file = open(os.path.join('share', 'applications', 'kernelcheck.desktop'), 'w')
out_file.write(data)
out_file.close()
## Prepare setup() directive
setup(name = "kernelcheck",
version = "1.2.5",
description = "Build the latest kernel",
author = "Master Kernel",
author_email = "master.kernel.contact@gmail.com",
url = "http://kcheck.sf.net",
packages = ['KernelCheck'],
scripts = ['kernelcheck'],
license = "GNU GPLv3",
data_files=[('share/kernelcheck/', ['share/kernelcheck/kernelcheck.glade']),
('share/kernelcheck/', ['share/kernelcheck/terminal.glade']),
('share/kernelcheck/', ['share/kernelcheck/fixed.list']),
('share/kernelcheck/', ['share/kernelcheck/License.txt']),
('share/kernelcheck/scripts', ['share/kernelcheck/scripts/kscript.sh']),
('share/kernelcheck/scripts', ['share/kernelcheck/scripts/build.py']),
('share/kernelcheck/scripts', ['share/kernelcheck/scripts/main.py']),
('/usr/share/pixmaps', ['share/kernelcheck/pixmaps/kernelcheck.png']),
('share/kernelcheck/pixmaps', ['share/kernelcheck/pixmaps/KernelCheckLogo.png']),
('share/kernelcheck/pixmaps', ['share/kernelcheck/pixmaps/kernelcheck.svg']),
('share/kernelcheck/pixmaps', ['share/kernelcheck/pixmaps/side.png']),
('/usr/share/applications', ['share/applications/kernelcheck.desktop'])]
)
We did this:
Code:
#!/usr/bin/env python
#########################################################################
## Import required modules
import os, sys, platform
from distutils.core import setup
## Get current Python version
python_version = platform.python_version_tuple()
## Make sure people are using Python 2.5 or higher
if python_version[0] < "2" and python_version[1] < "5":
print "The installed version of Python is to old."
print "We require as a minimum Python 2.5.x."
sys.exit(1)
## Prepare setup() directive
setup(name = "kernelcheck",
version = "1.2.5",
description = "Build the latest kernel",
author = "Master Kernel",
author_email = "master.kernel.contact@gmail.com",
url = "http://kcheck.sf.net",
packages = ['KernelCheck'],
scripts = ['kernelcheck'],
license = "GNU GPLv3",
data_files=[('/usr/share/kernelcheck/', ['share/kernelcheck/kernelcheck.glade']),
('/usr/share/kernelcheck/', ['share/kernelcheck/terminal.glade']),
('/usr/share/kernelcheck/', ['share/kernelcheck/fixed.list']),
('/usr/share/kernelcheck/', ['share/kernelcheck/License.txt']),
('/usr/share/kernelcheck/scripts', ['share/kernelcheck/scripts/kscript.sh']),
('/usr/share/kernelcheck/scripts', ['share/kernelcheck/scripts/build.py']),
('/usr/share/kernelcheck/scripts', ['share/kernelcheck/scripts/main.py']),
('/usr/share/pixmaps', ['share/kernelcheck/pixmaps/kernelcheck.png']),
('/usr/share/kernelcheck/pixmaps', ['share/kernelcheck/pixmaps/KernelCheckLogo.png']),
('/usr/share/kernelcheck/pixmaps', ['share/kernelcheck/pixmaps/kernelcheck.svg']),
('/usr/share/kernelcheck/pixmaps', ['share/kernelcheck/pixmaps/side.png']),
('/usr/share/applications', ['share/applications/kernelcheck.desktop'])]
)
Forcing a static path saved us a lot of effort.
Bookmarks