Python Setuptools build RPM error - python

I am trying to build RPM package for python setuptools-12.0.3 but getting wired error,
Its look like related to SPEC file %files -f INSTALLED_FILES but how to fix it? or is it a bug? I can see two files path in single line, how do i fix it?
+ /usr/lib/rpm/redhat/brp-strip-static-archive /usr/bin/strip
+ /usr/lib/rpm/redhat/brp-strip-comment-note /usr/bin/strip /usr/bin/objdump
This is the command i am using python2.7 setup.py bdist_rpm to build RPM
+ /usr/lib/rpm/redhat/brp-compress
+ /usr/lib/rpm/redhat/brp-strip-static-archive /usr/bin/strip
+ /usr/lib/rpm/redhat/brp-strip-comment-note /usr/bin/strip /usr/bin/objdump
+ /usr/lib/rpm/brp-python-bytecompile
Bytecompiling .py files below /root/rpmbuild/SOURCES/setuptools-12.0.3/build/bdist.linux-x86_64/rpm/BUILDROOT/setuptools-12.0.3-1.x86_64/usr/lib/python2.6 using /usr/bin/python2.6
+ /usr/lib/rpm/redhat/brp-python-hardlink
+ /usr/lib/rpm/redhat/brp-java-repack-jars
Processing files: setuptools-12.0.3-1.noarch
error: Two files on one line: /usr/lib/python2.6/site-packages/setuptools/script
error: File must begin with "/": (dev).tmpl
RPM build errors:
Two files on one line: /usr/lib/python2.6/site-packages/setuptools/script
File must begin with "/": (dev).tmpl
error: command 'rpmbuild' failed with exit status 1

Solution
After spending couple hours i figure out what was wrong:
copy setuptools.spec file in my own rpmbuild environment at /root/rpmbuild/SPECS/
Change %files -f INSTALLED_FILES to %files
Run rpmbuild -ba setuptools.spec
It generate list of files which need to add in %files section, But in that list there was one file which space in filename Ouch!!
script (dev).tmpl
I have used wildcard to match all files and problem solved. somehow rpmbuild doesn't understand escap character ( Don't know if there is a better way)
%files
%defattr(-,root,root)
...
...
/usr/local/lib/python2.7/site-packages/setuptools/script*
...

Related

How to add python-xbee receipes for yocto

My python-xbee-2.3.2.bb file contains:
SRC_URI="https://github.com/niolabs/python-xbee/archive/v2.3.2.tar.gz"
SRC_URI[md5sum] = "e74381e23f12159675d7ad92a06d8d0f"
DEPENDS += "${PYTHON_PN}-pytest-runner-native"
do_configure[noexec]="1"
inherit setuptools
RDEPENDS_${PN} += " \
${PYTHON_PN}-subprocess "
RDEPENDS_${PN} = "\
${PYTHON_PN}-fcntl \
${PYTHON_PN}-numbers \
${PYTHON_PN}-shell \
${PYTHON_PN}-stringold \
${PYTHON_PN}-io \
${PYTHON_PN}-logging \
${PYTHON_PN}-math \
${PYTHON_PN}-netclient \
${PYTHON_PN}-threading "
This is error getting when I compile bitbake python-xbee-2.3.2:
ERROR: python-xbee-2.3.2-1.0-r0 do_compile: 'python setup.py build '
execution failed. ERROR: python-xbee-2.3.2-1.0-r0 do_compile: Function
failed: do_compile (log file is located at
/home/chandra/yoctorpi/mender-raspberrypi/build/tmp/work/cortexa7t2hf-neon-vfpv4-poky-linux-gnueabi/python-xbee-2.3.2/1.0-r0/temp/log.do_compile.15930)
ERROR: Logfile of failure stored in:
/home//build/tmp/work/cortexa7t2hf-neon-vfpv4-poky-linux-gnueabi/python-xbee-2.3.2/1.0-r0/temp/log.do_compile.15930
After that am getting log data follows:
can't open file 'setup.py':[Errno 2] No such file or directory.
/home//build/tmp/work/cortexa7t2hf-neon-vfpv4-poky-linux-gnueabi/python-xbee-2.3.2/1.0-r0/recipe-sysroot-native/usr/bin/python-native/python: can't open file 'setup.py' :[Errno 2] No such file or directory
ERROR: 'python setup.py build ' execution failed
ERROR: Function failed: do_compile (log file is located at /home//build/tmp/work/cortexa7t2hf-neon-vfpv4-poky-linux-gnueabi/python-xbee-2.3.2/1.0-r0/temp/log.do_compile.15930)
ERROR: Task (/home//build/../sources/poky/meta/recipes-support/python-xbee-2.3.2/python-xbee-2.3.2.bb:do_compile) failed with exit code '1'
You should inherit pypi bbclass as well since this deals with python package installation:
inherit pypi
As a side notes:
Check how you assign RDEPENDS_${PN}, it looks that you just override it instead of updating.
The name of recipe according to standard should python-xbee_2.3.2.bb - note the underscore (assuming your package supports only python2.X).
It's not recommended to hard-code version in SRC_URI, check in the above link as well.

Kivy-ios Xcode build error

I'm trying to run my Kivy app in Xcode (5.1). So far, I've managed to create an Xcode project, but it gets weird in build phase, throws an error like so:
+ echo '-> Compile to pyo'
-> Compile to pyo
+ /Users/onebit0fme/kivy-ios/tmp/Python-2.7.1/hostpython -OO -m compileall /Users/onebit0fme/kivy-ios/app-MyApp/YourApp
../tools/populate-project.sh: line 32: /Users/onebit0fme/kivy-ios/tmp/Python- 2.7.1/hostpython: No such file or directory
+ echo '-> Remove unused files (pyc, py)'
-> Remove unused files (pyc, py)
+ find /Users/onebit0fme/kivy-ios/app-MyApp/YourApp -iname '*.py' -exec rm '{}' ';'
+ find /Users/onebit0fme/kivy-ios/app-MyApp/YourApp -iname '*.pyc' -exec rm '{}' ';'
+ echo '-> Source code of MyApp updated.'
-> Source code of MyApp updated.
Command /bin/sh emitted errors but did not return a nonzero exit code to indicate failure
Now, most interesting are these lines:
+ /Users/onebit0fme/kivy-ios/tmp/Python-2.7.1/hostpython -OO -m compileall /Users/onebit0fme/kivy-ios/app-MyApp/YourApp
../tools/populate-project.sh: line 32: /Users/onebit0fme/kivy-ios/tmp/Python- 2.7.1/hostpython: No such file or directory
I installed latest version of Python (2.7.6) with 'port' and set it to be default. What I don't understand are:
1. Why it tries to find Python-2.7.1 ???
2. Why it looks in 'kivy-ios/tmp/' folder (I'm sure it's not there, and never was)???
This error comes from 'kivy-ios/populate_project.sh' line 32:
echo "-> Compile to pyo"
$HOSTPYTHON -OO -m compileall $YOURAPPDIR
and I don't know where '$HOSTPYTHON' is coming from and why it gets evaluated to '/Users/onebit0fme/kivy-ios/tmp/Python-2.7.1/hostpython'.
I'm completely lost and desperate, please help who has at least a hint of what is going on.
UPDATE:
Turns out, when I did 'tools/build-all.sh', it did its job and echoed 'BUILD SUCCEEDED', but then "tar: Unrecognized archive format". As the result, there's no "build/python/lib/python27.zip" in kivy-ios folder. So, I guess, it didn't finish Kivy-ios installation, again, no idea why...
Solved. Indeed, turns out kivy-ios did not built all the packages because Python package has been moved to a new location (that's why "tar: Unrecognized archive format" appeared and I ignored it unfortunately). The solution is to change python package http in 'tools/build-python.sh'.
Here's the link to solution: https://github.com/kivy/kivy-ios/issues/85

Gcovr errors under Windows

I'm trying to generate a HTML file of results of a C program using Gcovr.
I've installed gcov (via MinGW), Python, easy_stall and gcovr.
Added the C:\MinGW\bin, C:\Python33 and C:\Python\Scripts to the Windows PATH.
Now the problems I'm having (in Windows commandline):
1. gcovr command
gcovr cannot be found/executed from any directory until executed from c:\Python33\Scripts with the python gcovr command.
Temp fix, rename gcovr to gcovr.py? But this doesn't sound as the right solution.
2. Executing gcovr
No results when I call:
c:\Python33\Scripts>python gcovr -r "d:\somepath\Debug"
------------------------------------------------------------------------------
File Lines Exec Cover Missing
------------------------------------------------------------------------------
------------------------------------------------------------------------------
TOTAL 0 0 --%
------------------------------------------------------------------------------
But gcov gives proper results.
D:\somepath\Debug>gcov some_file.gcda
File '../some_file.c'
Lines executed:21.43% of 14
Creating 'some_file.c.gcov'
What do I need to do to get proper results?
Try running the same command without the -r option, that is:
c:\Python33\Scripts>python gcovr "d:\somepath\Debug"
I had the same problem. I did solve it with following approach.
Go to root (main) directory of your project.
To generate output in Tabular format,
in command prompt, Give the command to generate coverage in
1) Tabular format
"python C:\Python27\Scripts\gcovr -r . --object-directory <path to *.gcno *.gcda file>"
2) XML format
"python C:\Python27\Scripts\gcovr -r . --object-directory <path to *.gcno *.gcda file> -x -o <desired_name.xml>"
3) HTML format
"python C:\Python27\Scripts\gcovr -r . --object-directory <path to *.gcno *.gcda file> –-html -o <desired_name.html>"
This post may resolve your issue.
GCOVR giving empty results zero percent in MAC
Had the same issue.
The problem is that your source file is not "below" the root folder and by default gcovr will filter it.
If you call
python gcovr -r "d:\somepath\Debug" --verbose
you will notice the line
Filtering coverage data for file ../some_file.c
An easy fix is to add a filter option:
python gcovr -r "d:\somepath\Debug" --verbose -f .*
From gcovr help:
-f FILTER, --filter=FILTER
Keep only the data files that match this regular
expression
What gcovr documentation fail to mention is that if you do not provide a filter it will use the root path as default filter.
Hope it will help someone.

windows wget & being cut off

System Info:
Windows 7,
GNU Wget 1.11.4,
Python 2.6
The problem:
Im running a python script that fires a wget shortcut, the problem is that wget (even when run purely in command line from the exe) cuts off '&''s. For example when i run the code below, this is what i get:
C:\Program Files\GnuWin32\bin>wget.exe
http://www.imdb.com/search/title?genres=action&sort=alpha,asc&start=51&title_type=feature
SYSTEM_WGETRC = c:/progra~1/wget/etc/wgetrc syswgetrc = C:\Program
Files\GnuWin32/etc/wgetrc
--2013-01-18 12:48:43-- http://www.imdb.com/search/title?genres=action Resolving
www.imdb.com... 72.21.215.52 Connecting to
www.imdb.com|72.21.215.52|:80... failed: Connection refused.
=alpha,ascThe system cannot find the file specified.
The system cannot find the file 51. 'title_type' is not recognized as an internal or
external command, operable program or batch file.
As you can see, wget counts all text before the '&' as the URL in question, and windows take the last half as a new command(s).
There has got to be some way of allowing wget to capture that whole string as the URL.
Thanks in advance.
EDIT:
When i call the command in command line with brackets around it, it works great, however, when i run the script through python:
subprocess.Popen(['start /B wget.lnk --directory-prefix=' + output_folder + ' --output-document=' + output_folder + 'this.html "http://www.imdb.com/search/title?genres=action&sort=alpha,asc&start=51&title_type=feature"'], shell=True)
I get the following error:
SYSTEM_WGETRC = c:/progra~1/wget/etc/wgetrc
syswgetrc = C:\Program Files (x86)\GnuWin32/etc/wgetrc
"http://www.imdb.com/search/title?genres=action&sort=alpha,asc&start=51&title_ty
pe=feature": Unsupported scheme.
It's not Wget that cuts off the URL, but the command interpreter, which uses & to separate two commands, akin to ;. This is indicated by the =alpha,ascThe system cannot find the file specified. error on the following line.
To prevent this from happening, quote the entire URL:
wget.exe "http://www.imdb.com/search/title?genres=action&sort=alpha,asc&start=51&title_type=feature"

problem compiling libjingle

I downloaded and installed libjingle-0.5.2.zip, and according to the README also downloaded and installed swtoolkit.0.9.1.zip, scons-local-2.1.0.alpha.20101125.tar.gz, and expat-2.0.1.tar.gz, and got nrtp by cvs download. After overwriting my Makefile twice, attempting to follow the rather poorly-written README, I came up with the following Makefile that almost works:
# First, make sure the SCONS_DIR environment variable is set correctly.
SCONS_DIR ?= /usr/src/scons-local/scons-local-2.1.0.alpha.20101125/
#SCONS_DIR ?= /usr/src/scons-local/
export
default: build
# Second, run talk/third_party/expat-2.0.1/configure...
talk/third_party/expat-2.0.1/Makefile:
cd talk/third_party/expat-2.0.1 && ./configure
# ...and talk/third_party/srtp/configure.
talk/third_party/srtp/Makefile:
cd talk/third_party/srtp && ./configure
# Third, go to the talk/ directory and run $path_to_swtoolkit/hammer.sh. Run
# $path_to_swtoolkit/hammer.sh --help for information on how to build for
# different modes.
build: talk/third_party/expat-2.0.1/Makefile talk/third_party/srtp/Makefile
cd talk && ../../swtoolkit/hammer.sh
help:
../swtoolkit/hammer.sh --help
However, make gives me the following errors:
jcomeau#intrepid:/usr/src/libjingle-0.5.2$ make
cd talk && ../../swtoolkit/hammer.sh
*** Error loading site_init file './../../swtoolkit/site_scons/site_init.py':
AttributeError: 'Dir' object has no attribute 'endswith':
File "/usr/src/scons-local/scons-local-2.1.0.alpha.20101125/SCons/Script/Main.py", line 1338:
_exec_main(parser, values)
File "/usr/src/scons-local/scons-local-2.1.0.alpha.20101125/SCons/Script/Main.py", line 1302:
_main(parser)
File "/usr/src/scons-local/scons-local-2.1.0.alpha.20101125/SCons/Script/Main.py", line 929:
_load_site_scons_dir(d.path, options.site_dir)
File "/usr/src/scons-local/scons-local-2.1.0.alpha.20101125/SCons/Script/Main.py", line 719:
exec fp in site_m
File "./../../swtoolkit/site_scons/site_init.py", line 455:
SiteInitMain()
File "./../../swtoolkit/site_scons/site_init.py", line 451:
SCons.Node.FS.get_default_fs().SConstruct_dir, None)
File "/usr/src/scons-local/scons-local-2.1.0.alpha.20101125/SCons/Script/Main.py", line 677:
site_dir = os.path.join(topdir, site_dir_name)
File "/usr/lib/python2.6/posixpath.py", line 67:
elif path == '' or path.endswith('/'):
make: *** [build] Error 2
I'm guessing that something new (a 'Dir' object being where a POSIX path string is expected) in one of the packages is breaking the build process, but which one? There are just too many layers of cruft here for me to follow. For sure I could just keep trying older packages, particularly for swtoolkit and scons, but if anyone here has successfully compiled libjingle and could prod me in the right direction, I'd appreciate it.
I'm not familiar with the project, but think I have a fix to get you past that point. You need to cast those Dir instances using str() in swtoolkit/site_scons/site_init.py. That way they can safely be evaluated by path.endswith('/'). Odd that such an issue would exist for very long in the main part of the build infrastructure:
Line 330:
SCons.Script.Main._load_site_scons_dir(
str(SCons.Node.FS.get_default_fs().SConstruct_dir), site_dir)
Line 450:
SCons.Script.Main._load_site_scons_dir(
str(SCons.Node.FS.get_default_fs().SConstruct_dir), None)
I did following to build libjingle :
Building LibJingle for Linux
How to Build
Libjingle is built with swtoolkit ( http://code.google.com/p/swtoolkit/), which
is a set of extensions to the open-source SCons build tool ( http://www.scons.org).
First, install Python 2.4 or later from http://www.python.org/.
Please note that since swtoolkit only works with Python 2.x, you will
not be able to use Python 3.x.
Second, install the stand alone scons-local package 2.0.0 or later from
http://www.scons.org/download.php and set an environment variable,
SCONS_DIR, to point to the directory containing SCons, for example,
/src/libjingle/scons-local/scons-local-2.0.0.final.0/.
Third, install swtoolkit from http://code.google.com/p/swtoolkit/.
Finally, Libjingle depends on two open-source projects, expat and srtp.
Download expat from http://sourceforge.net/projects/expat/ to
talk/third_party/expat-2.0.1/. Follow the instructions at
http://sourceforge.net/projects/srtp/develop to download latest srtp to
talk/third_party/srtp. Note that srtp-1.4.4 does not work since it misses
the extensions used by Libjingle.
If you put expat or srtp in a different directory, you need to edit
talk/libjingle.scons correspondingly.
2.1 Build Libjingle under Linux or OS X
First, make sure the SCONS_DIR environment variable is set correctly.
Second, run talk/third_party/expat-2.0.1/configure and
talk/third_party/srtp/configure.
Third, go to the talk/ directory and run $path_to_swtoolkit/hammer.sh. Run
$path_to_swtoolkit/hammer.sh --help for information on how to build for
different modes.
Other than above given steps, See following as reference
Set SCONS_DIR Path
export SCONS_DIR=/home/esumit/libjingle/libjingle-0.5.2/talk/third_party/scons-local/scons-local-2.0.1
Install libasound2-dev Lib to compile libJingle, otherwise you will encounter errors.
sudo apt-get install libasound2-dev
Download SRTP using the following command. If it asks for a passowrd, just hit Enter.
cvs -z3 -d:pserver:anonymous#srtp.cvs.sourceforge.net:/cvsroot/srtp co -P srtp
Possible components in LibJingle Directory
libjingle-0.5.2/talk/third_party$ ls
expat-2.0.1 libudev scons-local srtp swtoolkit
Execute following command to build LibJingle
libjingle-0.5.2/talk$ ./third_party/swtoolkit/hammer.sh

Categories