Bugs item #1267547, was opened at 2005-08-24 02:59 Message generated for change (Comment added) made by pearu You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1267547&group_id=5470
Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Distutils Group: None Status: Open Resolution: None Priority: 7 Submitted By: Fernando Pérez (fer_perez) Assigned to: Martin v. Löwis (loewis) Summary: bdist_rpm hardcodes setup.py as the script name Initial Comment: The bdist_rpm command hardcodes 'setup.py' as the name of the setup script in the .spec file it generates. A grep of the bdist_rpm file shows this: planck[command]> grep -n -C 3 setup.py bdist_rpm.py 454- 455- # rpm scripts 456- # figure out default build script 457: def_build = "%s setup.py build" % self.python 458- if self.use_rpm_opt_flags: 459- def_build = 'env CFLAGS="$RPM_OPT_FLAGS" ' + def_build 460- -- 468- ('prep', 'prep_script', "%setup"), 469- ('build', 'build_script', def_build), 470- ('install', 'install_script', 471: ("%s setup.py install " 472- "--root=$RPM_BUILD_ROOT " 473- "--record=INSTALLED_FILES") % self.python), 474- ('clean', 'clean_script', "rm -rf $RPM_BUILD_ROOT"), But there are packages out there which ship with multiple setup files, named setup-foo.py, setup-bar.py, etc. While distutils correctly copies over the proper setup-X.py file to the build/ directory, the bdist_rpm command fails because rpm then tries to issue a build command against 'setup.py', which doesn't exist. An example can be seen by downloading the clnum library from http://calcrpnpy.sourceforge.net/clnum.html, and trying: lanck[rpncalc-2.0]> python clnum_setup.py bdist_rpm running bdist_rpm creating build creating build/bdist.linux-i686 creating build/bdist.linux-i686/rpm creating build/bdist.linux-i686/rpm/SOURCES creating build/bdist.linux-i686/rpm/SPECS creating build/bdist.linux-i686/rpm/BUILD creating build/bdist.linux-i686/rpm/RPMS creating build/bdist.linux-i686/rpm/SRPMS writing 'build/bdist.linux-i686/rpm/SPECS/clnum.spec' running sdist warning: sdist: manifest template 'MANIFEST.in' does not exist (using default file list) warning: sdist: standard file not found: should have one of README, README.txt writing manifest file 'MANIFEST' creating clnum-1.0 creating clnum-1.0/clnum creating clnum-1.0/clnum/src creating clnum-1.0/test making hard links in clnum-1.0... hard linking clnum_setup.py -> clnum-1.0 hard linking clnum/__init__.py -> clnum-1.0/clnum hard linking clnum/_clnum_str.py -> clnum-1.0/clnum hard linking clnum/src/clnum.cpp -> clnum-1.0/clnum/src hard linking test/test_clnum.py -> clnum-1.0/test [... snip] Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.8191 + umask 022 + cd /usr/local/installers/src/rpncalc-2.0/build/bdist.linux-i686/rpm/BUILD + cd clnum-1.0 + LANG=C + export LANG + unset DISPLAY + env 'CFLAGS=-O2 -g -pipe -m32 -march=i386 -mtune=pentium4' python setup.py build python: can't open file 'setup.py' error: Bad exit status from /var/tmp/rpm-tmp.8191 (%build) I think that the fix is as simple as replacing the hardcoded 'setup.py' name by os.path.basename(sys.argv[0]), but I'm not 100% sure. ---------------------------------------------------------------------- Comment By: Pearu Peterson (pearu) Date: 2006-01-28 11:18 Message: Logged In: YES user_id=88489 Related bug is 828743. In numpy.distutils we have long time used the same patch as suggested by fer_perez without problems. ---------------------------------------------------------------------- Comment By: Fernando Pérez (fer_perez) Date: 2005-08-24 20:12 Message: Logged In: YES user_id=395388 Well, here's a patch against 2.4 (sorry, but I can't build from CVS right now, I hope this is enough. I tested it on my problem build linked above, and it now works correctly, but I'm not a distutils expert, so I can't vouch 100% that it won't break in some corner case. It would be worth making sure that other similar commands (like the new bdist_deb in CVS) don't share the problem. ---------------------------------------------------------------------- Comment By: Martin v. Löwis (loewis) Date: 2005-08-24 08:41 Message: Logged In: YES user_id=21627 Would you like to try your proposed fix yourself, and contribute a patch? ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1267547&group_id=5470 _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com