Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#35332 closed defect (fixed)

py-keyring will not install

Reported by: pavel.hlavnicka@… Owned by: anddam (Andrea D'Amore)
Priority: Normal Milestone:
Component: ports Version: 2.1.2
Keywords: Cc:
Port: py-keyring

Description (last modified by anddam (Andrea D'Amore))

Have seen similar issues but no generic solution. Sorry for possible duplicate.

Running freshly installed Mac OS X 10.8

Issuing: sudo port install py-keyring breaks with

:info:build   File "setup.py", line 24, in <module>
:info:build     version = runcmd(['/usr/bin/xcodebuild', '-version'], {})[0].splitlines()[0]
:info:build IndexError: list index out of range

Attachments (7)

main.log (4.0 KB) - added by pavel.hlavnicka@… 12 years ago.
The log file
main.2.log (21.4 KB) - added by pavel.hlavnicka@… 12 years ago.
Log of an another try
port-py_keyring.diff (1.6 KB) - added by anddam (Andrea D'Amore) 12 years ago.
py27-keyring_python-output.txt (19.7 KB) - added by pavel.hlavnicka@… 12 years ago.
port log py27-keyring output
port-py_keyring-print_list.diff (1.3 KB) - added by anddam (Andrea D'Amore) 12 years ago.
py-keyring-log-2012-08020.txt (18.6 KB) - added by pavel.hlavnicka@… 12 years ago.
full log of sudo port -d build py27-keyring relevant to comment 13
port-py_keyring-tmp.tar (6.0 KB) - added by anddam (Andrea D'Amore) 12 years ago.

Download all attachments as: .zip

Change History (29)

Changed 12 years ago by pavel.hlavnicka@…

Attachment: main.log added

The log file

comment:1 Changed 12 years ago by ryandesign (Ryan Carsten Schmidt)

Owner: changed from macports-tickets@… to and.damore@…

The tclIndex error messages are unrelated to the problem and should be ignored.

This log contains lines that say "Skipping completed" so we cannot rely on its contents. Please "sudo port clean py27-keyring" and try again, then attach the new main.log file to this ticket if it fails again.

Changed 12 years ago by pavel.hlavnicka@…

Attachment: main.2.log added

Log of an another try

comment:2 Changed 12 years ago by pavel.hlavnicka@…

I did

sudo port clean py27-keyring
sudo port clean py-keyring
sudo port install py27-keyring

... and got the log as attached (main.2.log)

comment:3 in reply to:  description Changed 12 years ago by kuenstler@…

I had a similar problem and solved it by doing the following in a terminal

cd /System/Library/Frameworks/Tcl.framework/Versions/8.5/Resources
sudo ln -s Scripts/tclIndex .

comment:4 Changed 12 years ago by anddam (Andrea D'Amore)

Status: newassigned

comment:5 Changed 12 years ago by anddam (Andrea D'Amore)

Description: modified (diff)

Edited description to report the actual issue. Please provide the output of:

/usr/bin/xcodebuild -version

comment:6 Changed 12 years ago by pavel.hlavnicka@…

xxx:~ pavel$ /usr/bin/xcodebuild -version
Xcode 4.4
Build version 4F250

comment:7 in reply to:  6 Changed 12 years ago by anddam (Andrea D'Amore)

Replying to pavel.hlavnicka@…:

xxx:~ pavel$ /usr/bin/xcodebuild -version
Xcode 4.4
Build version 4F250

That output seems oddly sane (I expected it not to be).

This issue has been related to Xcode updating and to versiontools outdated install.

Please paste the output of the following commands, one per line:

xcode-select -print-path
port select  --show python
which python
python -c "import subprocess;  print(subprocess.Popen(['/usr/bin/xcodebuild', '-version'], env={}, stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate())"
/usr/bin/xcode-select -print-path

comment:8 Changed 12 years ago by pavel.hlavnicka@…

xxx:~ pavel$ xcode-select -print-path
/Applications/Xcode.app/Contents/Developer

xxx:~ pavel$ port select  --show python
The currently selected version for 'python' is 'python27'.

xxx:~ pavel$ which python
/opt/local/bin/python

xxx:~ pavel$ python --version
Python 2.7.3

xxx:~ pavel$ python -c "import subprocess;  print(subprocess.Popen(['/usr/bin/xcodebuild', '-version'], env={}, stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate())"
('Xcode 4.4\nBuild version 4F250\n', '')

xxx:~ pavel$ which xcodebuild
/usr/bin/xcodebuild

... I have just tried port install py-keyring on the same terminal as the above with the same issue in the log file... btw I'm quite savvy in osx and command line etc... not particularly in python/port files.... feel free to mail me and we can do some online session to investigate.

comment:9 in reply to:  8 ; Changed 12 years ago by anddam (Andrea D'Amore)

Replying to pavel.hlavnicka@…:

xxx:~ pavel$ xcode-select -print-path
/Applications/Xcode.app/Contents/Developer

xxx:~ pavel$ port select  --show python
The currently selected version for 'python' is 'python27'.

xxx:~ pavel$ which python
/opt/local/bin/python

xxx:~ pavel$ python --version
Python 2.7.3

xxx:~ pavel$ python -c "import subprocess;  print(subprocess.Popen(['/usr/bin/xcodebuild', '-version'], env={}, stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate())"
('Xcode 4.4\nBuild version 4F250\n', '')

xxx:~ pavel$ which xcodebuild
/usr/bin/xcodebuild

All your output seems safe, but the log error clearly indicates

IndexError: list index out of range'' on the runcmd() return value

so something is wrong while running setup.py

... I have just tried port install py-keyring on the same terminal as the above with the same issue in the log file

That's weird, py-keyring shouldn't build anything at all when not build a subport like py27-keyring

Retry building py-keyring cleaning the ports before

port clean py27-keyring py-keyring
port -d install py-keyring

feel free to mail me and we can do some online session to investigate

I usually hang out on the IRC channel.

I'm attaching a portfile patch, please download port-py_keyring.diff, execute

cd $(port dir py-keyring)
sudo port clean py27-keyring py-keyring
patch -p0 <~/Downloads/port-py_keyring.diff
sudo port -v build py27-keyring | grep commandRes

and paste the output.

Changed 12 years ago by anddam (Andrea D'Amore)

Attachment: port-py_keyring.diff added

comment:10 in reply to:  9 Changed 12 years ago by pavel.hlavnicka@…

Retry building py-keyring cleaning the ports before

port clean py27-keyring py-keyring
port -d install py-keyring

gives the same error as we know it...

I'm attaching a portfile patch, please download port-py_keyring.diff, execute

cd $(port dir py-keyring)
sudo port clean py27-keyring py-keyring
patch -p0 <~/Downloads/port-py_keyring.diff
sudo port -v build py27-keyring | grep commandRes
commandResult:tuple
commandResult[0]:str
commandResult[0].splitlines():list
    print('commandResult[0].splitlines()[0]:' + type(commandResult[0].splitlines()[0]).__name__)
Error: org.macports.build for port py27-keyring returned: command execution failed
Error: Processing of port py27-keyring failed

HTH

comment:11 Changed 12 years ago by anddam (Andrea D'Amore)

Please run

port log py27-keyring > py27-keyring_python-output.txt

and paste the created file, I'd like to see the actual error when the script tries to index the list containing the splitted lines.

comment:12 in reply to:  11 Changed 12 years ago by anddam (Andrea D'Amore)

Replying to and.damore@…:

and paste the created file

*attach* the *resulting* file

Changed 12 years ago by pavel.hlavnicka@…

port log py27-keyring output

comment:13 Changed 12 years ago by anddam (Andrea D'Amore)

Please download the attached file called port-py_keyring-print_list.diff and execute:

cd $(port dir py-keyring)
patch -p0 -R <~/Downloads/port-py_keyring.diff #this reverts previous patch
patch -p0 <~/Downloads/port-py_keyring-print_list.diff #this is basically the same patch but prints list's content
sudo port clean py27-keyring
sudo port -d build py27-keyring

then copy and paste lines nearby the error.

Changed 12 years ago by anddam (Andrea D'Amore)

comment:14 Changed 12 years ago by pavel.hlavnicka@…

not sure if this is anyhow helpful... but if I run sudo port -d install py-keyring I got the well known error

DEBUG: Executing command line:  cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_python_py-keyring/py27-keyring/work/keyring-0.6.2" && /opt/local/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7 setup.py --no-user-cfg build 
Traceback (most recent call last):
  File "setup.py", line 24, in <module>
    version = runcmd(['/usr/bin/xcodebuild', '-version'], {})[0].splitlines()[0]
IndexError: list index out of range

but then if I did cd /opt/local.... from the failed command and then sudo /opt/local/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7 setup.py --no-user-cfg build from the command line, I got this

running build
running build_py
creating build
creating build/lib.macosx-10.8-x86_64-2.7
creating build/lib.macosx-10.8-x86_64-2.7/keyring
copying keyring/__init__.py -> build/lib.macosx-10.8-x86_64-2.7/keyring
copying keyring/backend.py -> build/lib.macosx-10.8-x86_64-2.7/keyring
copying keyring/cli.py -> build/lib.macosx-10.8-x86_64-2.7/keyring
copying keyring/core.py -> build/lib.macosx-10.8-x86_64-2.7/keyring
copying keyring/getpassbackend.py -> build/lib.macosx-10.8-x86_64-2.7/keyring
copying keyring/http.py -> build/lib.macosx-10.8-x86_64-2.7/keyring
creating build/lib.macosx-10.8-x86_64-2.7/keyring/tests
copying keyring/tests/__init__.py -> build/lib.macosx-10.8-x86_64-2.7/keyring/tests
copying keyring/tests/test_backend.py -> build/lib.macosx-10.8-x86_64-2.7/keyring/tests
copying keyring/tests/test_cli.py -> build/lib.macosx-10.8-x86_64-2.7/keyring/tests
copying keyring/tests/test_core.py -> build/lib.macosx-10.8-x86_64-2.7/keyring/tests
copying keyring/tests/test_util.py -> build/lib.macosx-10.8-x86_64-2.7/keyring/tests
creating build/lib.macosx-10.8-x86_64-2.7/keyring/util
copying keyring/util/__init__.py -> build/lib.macosx-10.8-x86_64-2.7/keyring/util
copying keyring/util/escape.py -> build/lib.macosx-10.8-x86_64-2.7/keyring/util
creating build/lib.macosx-10.8-x86_64-2.7/keyring/backends
copying keyring/backends/__init__.py -> build/lib.macosx-10.8-x86_64-2.7/keyring/backends
running build_ext
building 'osx_keychain' extension
creating build/temp.macosx-10.8-x86_64-2.7
creating build/temp.macosx-10.8-x86_64-2.7/keyring
creating build/temp.macosx-10.8-x86_64-2.7/keyring/backends
/usr/bin/clang -fno-strict-aliasing -fno-common -dynamic -pipe -O2 -fwrapv -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/opt/local/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c keyring/backends/osx_keychain.c -o build/temp.macosx-10.8-x86_64-2.7/keyring/backends/osx_keychain.o
/usr/bin/clang -bundle -undefined dynamic_lookup -L/opt/local/lib build/temp.macosx-10.8-x86_64-2.7/keyring/backends/osx_keychain.o -L/System/Library/Frameworks/ -o build/lib.macosx-10.8-x86_64-2.7/osx_keychain.so -framework Security -framework CoreFoundation -framework CoreServices

I'm not familiar with macports build process - so this observation can be meaning less - or it shows that the environment is somehow modified by invoking port install... compared to a vanilla command line. environment.

Can this help somehow?

comment:15 in reply to:  14 Changed 12 years ago by anddam (Andrea D'Amore)

Replying to pavel.hlavnicka@…:

it shows that the environment is somehow modified by invoking port install... compared to a vanilla command line. environment.

Indeed it is but your envinroment (that you can see in the debug output) is just good and actually it differs from mine only for the 10.7/10.8 and rsync/svn part.

I'd like to get the output I asked for in ticket:35332#comment:13 , the code block reverts previous patch and applies the new one to check what the failing list contains.

If the patch command with revert flag -R complains, for instance because you ran sync action since the portfile was last patched and the Portfile has therefore already been reverted, you can just skip that command.

comment:16 Changed 12 years ago by pavel.hlavnicka@…

Sorry, I did not notice comment 13 as I should have. If I ran all as described I got following

DEBUG: Executing command line:  cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_python_py-keyring/py27-keyring/work/keyring-0.6.2" && /opt/local/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7 setup.py --no-user-cfg build 
[]
Traceback (most recent call last):
  File "setup.py", line 26, in <module>
    version = commandResult[0].splitlines()[0]
IndexError: list index out of range

I believe the line containing solely '[]' is what you are looking for right? I'll attach the full log as well.

Changed 12 years ago by pavel.hlavnicka@…

full log of sudo port -d build py27-keyring relevant to comment 13

comment:17 in reply to:  16 Changed 12 years ago by anddam (Andrea D'Amore)

Replying to pavel.hlavnicka@…:

I believe the line containing solely '[]' is what you are looking for right? I'll attach the full log as well.

Yes, and that empty list is odd since you've run that very same command explicitly and got correct output in ticket:35332#comment:8 . Unluckily I don't know what it is caused from and this kind of debugging is quite slow via tickets.

Since you're using Xcode 4.4+ you can set up a local repository and just skip the subprocess calling that is just needed to check the Xcode version.

I'm attaching a tar archive with such a patched port, create a python subdir in your local repository and extract the archive there. This is not a fix but a mean to let you install py-keyring meanwhile.

Changed 12 years ago by anddam (Andrea D'Amore)

Attachment: port-py_keyring-tmp.tar added

comment:18 Changed 12 years ago by pavel.hlavnicka@…

Thanks for this. Could you provide a path just dumping as much of the environment as possible? PATH, PYTHONPATH, current python interpreter (something like $0)... I did play with xcode-select a bit with no success. I have XCode3 installed concurrently, but I can not imagine how it could interfere.

comment:19 Changed 12 years ago by pavel.hlavnicka@…

BTW - just non-biased view - it may look like runcmd() is doing something else then we expect. The line reads commandResult = runcmd(['/usr/bin/xcodebuild', '-version'], {}) - the command is specified with the full path and the path contains a working xcodebuild version. Is not it possible that setup.py is invoking an another runcmd() imported, say, coincidentally?

comment:20 Changed 12 years ago by pavel.hlavnicka@…

SOLVED

ok... I did following, I have manually edited the latest patch

--- setup.py.orig	2011-08-03 22:08:15.000000000 +0200
+++ setup.py	2012-08-03 11:17:49.000000000 +0200
@@ -21,7 +21,9 @@
 if sys.platform == 'darwin' and os.path.exists('/usr/bin/xcodebuild'):
     # XCode 4.0 dropped support for ppc architecture, which is hardcoded in
     # distutils.sysconfig
-    version = runcmd(['/usr/bin/xcodebuild', '-version'], {})[0].splitlines()[0]
+    commandResult, err = runcmd(['/usr/bin/xcodebuild', '-version'], {})
+    print(err)
+    version = commandResult[0].splitlines()[0]
     # Also parse only first digit, because 3.2.1 can't be parsed nicely
     if (version.startswith('Xcode') and
         StrictVersion(version.split()[1]) >= StrictVersion('4.0')):

... to see the error returned by runcmd - and I got following:

DEBUG: Executing command line:  cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_python_py-keyring/py27-keyring/work/keyring-0.6.2" && /opt/local/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7 setup.py --no-user-cfg build 

You have not agreed to the Xcode license agreements, please run 'xcodebuild -license' (for user-level acceptance) or 'sudo xcodebuild -license' (for system-wide acceptance) from within a Terminal window to review and agree to the Xcode license agreements.

Traceback (most recent call last):
  File "setup.py", line 26, in <module>
    version = commandResult[0].splitlines()[0]

after running the stated command as root sudo xcodebuild -license and agreed with the license all works just fine.

This must somehow relate to my upgrade to Mac OS X 10.8 and XCode 4.4.1 - I just wonder how it's possible it seems it was only me having this issue. Many thanks for all your support and I hope this will help someone. Perhaps the setup.py might be more descriptive on the error.

comment:21 Changed 12 years ago by anddam (Andrea D'Amore)

Resolution: fixed
Status: assignedclosed

Wonderful, the issue wasn't py-keyring specific at last. I wonder why you had sane output when directly executing Subprocess' Popen() call.

As future reference cf. ProblemHotlist. I'm unsure about how to close this issue, I'm marking it as fixed even if it wasn't a port issue.

comment:22 Changed 12 years ago by pavel.hlavnicka@…

Executing the command manually was working because I did it as a normal user. Apple requires an another acceptance done by the superuser for "system wide" use. The problem was not in the environment but in general user permissions. I believe many people solve thos issue as soon as they try to use "sudo xcodebuild" in an another context. I just was not as lucky and the error was masked by overoptimistic setup.py. Again many thanks for your patience and help.

Note: See TracTickets for help on using tickets.