Python 警告:运行setup.py时,DistUtilsExtra.auto无法识别以下文件

Python 警告:运行setup.py时,DistUtilsExtra.auto无法识别以下文件,python,distutils,setup.py,Python,Distutils,Setup.py,我试图在Ubuntu 12.04/12.10上安装Quickshot应用程序,每当我运行setup.py时,都会遇到以下错误(不管我是运行setup.py、setup.py check、setup.py build还是setup.py clean,我都没有尝试过setup.py安装) 我还在中粘贴setup.py文件的副本。在Ubuntu12.10上,bin/quickshot不会触发,但其余的都会触发。非常感谢您对如何解决此问题提出的任何建议 谢谢,祝你周末愉快(剩下的是什么):) 帕特里克

我试图在Ubuntu 12.04/12.10上安装Quickshot应用程序,每当我运行setup.py时,都会遇到以下错误(不管我是运行setup.py、setup.py check、setup.py build还是setup.py clean,我都没有尝试过setup.py安装)

我还在中粘贴setup.py文件的副本。在Ubuntu12.10上,bin/quickshot不会触发,但其余的都会触发。非常感谢您对如何解决此问题提出的任何建议

谢谢,祝你周末愉快(剩下的是什么):) 帕特里克

setup.py

    #!/usr/bin/env python
    # -*- coding: utf-8 -*-
    ### BEGIN LICENSE
    # Copyright (C) 2010 Benjamin Humphrey <humphreybc@gmail.co>
    #This program is free software: you can redistribute it and/or modify it 
    #under the terms of the GNU General Public License version 3, as published 
    #by the Free Software Foundation.
    #
    #This program is distributed in the hope that it will be useful, but 
    #WITHOUT ANY WARRANTY; without even the implied warranties of 
    #MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR 
    #PURPOSE.  See the GNU General Public License for more details.
    #
    #You should have received a copy of the GNU General Public License along 
    #with this program.  If not, see <http://www.gnu.org/licenses/>.
    ### END LICENSE

    ###################### DO NOT TOUCH THIS (HEAD TO THE SECOND PART) ######################

    try:
        import DistUtilsExtra.auto
    except ImportError:
        import sys
        print >> sys.stderr, 'To build quickshot you need https://launchpad.net/python-distutils-extra'
        sys.exit(1)

    assert DistUtilsExtra.auto.__version__ >= '2.10', 'needs DistUtilsExtra.auto >= 2.10'
    import os


    def update_data_path(prefix, oldvalue=None):

        try:
            fin = file('quickshot/quickshotconfig.py', 'r')
            fout = file(fin.name + '.new', 'w')

            for line in fin:            
                fields = line.split(' = ') # Separate variable from value
                if fields[0] == '__quickshot_data_directory__':
                     # update to prefix, store oldvalue
                    if not oldvalue:
                        oldvalue = fields[1]
                        line = "%s = '%s'\n" % (fields[0], prefix)
                    else: # restore oldvalue
                        line = "%s = %s" % (fields[0], oldvalue)
                fout.write(line)

            fout.flush()
            fout.close()
            fin.close()
            os.rename(fout.name, fin.name)
        except (OSError, IOError), e:
            print ("ERROR: Can't find quickshot/quickshotconfig.py")
            sys.exit(1)
        return oldvalue


    def update_desktop_file(datadir):

        try:
            fin = file('quickshot.desktop.in', 'r')
            fout = file(fin.name + '.new', 'w')

            for line in fin:            
                 if 'Icon=' in line:
                    line = "Icon=%s\n" % (datadir + 'media/icon.png')
                fout.write(line)
            fout.flush()
            fout.close()
            fin.close()
            os.rename(fout.name, fin.name)
        except (OSError, IOError), e:
            print ("ERROR: Can't find quickshot.desktop.in")
            sys.exit(1)


    class InstallAndUpdateDataDirectory(DistUtilsExtra.auto.install_auto):
        def run(self):
            if self.root or self.home:
                print "WARNING: You don't use a standard --prefix installation, take care that you eventually " \
                "need to update quickly/quicklyconfig.py file to adjust __quickly_data_directory__. You can " \
                "ignore this warning if you are packaging and uses --prefix."
            previous_value = update_data_path(self.prefix + '/share/quickshot/')
            update_desktop_file(self.prefix + '/share/quickshot/')
            DistUtilsExtra.auto.install_auto.run(self)
            update_data_path(self.prefix, previous_value)



    ##################################################################################
    ###################### YOU SHOULD MODIFY ONLY WHAT IS BELOW ######################
    ##################################################################################

    DistUtilsExtra.auto.setup(
        name='quickshot',
        version='0.0.83',
        license='GPL-3',
        author='Benjamin Humphrey, Tommy Brunn',
        author_email='humphreybc@gmail.com',
        url='https://launchpad.net/quickshot',
        description='Quickshot is a program designed for capturing a large number of screenshots in different languages. It is principally designed for use with the Ubuntu Manual Project, but should be able to be tweaked for different projects and uses.',
        #long_description='Here a longer description',
        cmdclass={'install': InstallAndUpdateDataDirectory}
        )
以下是setup.py安装的结果:

    running install
    ERROR: Can't find quickshot/quickshotconfig.py
    Traceback (most recent call last):
      File "setup.py", line 103, in <module>
        cmdclass={'install': InstallAndUpdateDataDirectory}
      File "/usr/lib/python2.7/dist-packages/DistUtilsExtra/auto.py", line 100, in setup
        distutils.core.setup(**attrs)
      File "/usr/lib/python2.7/distutils/core.py", line 152, in setup
        dist.run_commands()
      File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands
        self.run_command(cmd)
      File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
        cmd_obj.run()
      File "setup.py", line 83, in run
        previous_value = update_data_path(self.prefix + '/share/quickshot/')
      File "setup.py", line 54, in update_data_path
        sys.exit(1)
    NameError: global name 'sys' is not defined
正在运行安装
错误:找不到quickshot/quickshotconfig.py
回溯(最近一次呼叫最后一次):
文件“setup.py”,第103行,在
cmdclass={'install':InstallAndUpdateDataDirectory}
文件“/usr/lib/python2.7/dist-packages/DistUtilsExtra/auto.py”,第100行,在安装程序中
distutils.core.setup(**attrs)
文件“/usr/lib/python2.7/distutils/core.py”,第152行,在安装程序中
dist.run_命令()
文件“/usr/lib/python2.7/distutils/dist.py”,第953行,在run_命令中
self.run_命令(cmd)
文件“/usr/lib/python2.7/distutils/dist.py”,第972行,在run_命令中
cmd_obj.run()
运行中第83行的文件“setup.py”
上一个_值=更新_数据_路径(self.prefix+'/share/quickshot/)
文件“setup.py”,第54行,在更新数据路径中
系统出口(1)
NameError:未定义全局名称“sys”

setup.py build的结果如下:警告与错误不同。库本身安装了吗?我还没有尝试安装setup.py。因为我收到了警告,我不确定我是否应该试试。我将setup.py安装的结果发布在我的原始帖子的底部,因为它对于注释setcion来说太长了大约360个字符。难道没有一个Ubuntu软件包可以安装吗?或者你正在开发这个软件包?ubuntu软件包已经过时了。自从Ubuntu10.04或11.04以来,它就没有被开发过。我主要是想找出什么坏了,看看它是否在12.04/12.10仍然有效。如果这是一个失败的事业,那么他们将完全放弃它。
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-2.7
    creating build/lib.linux-x86_64-2.7/quickshot
    creating build/lib.linux-x86_64-2.7/quickshot/lib
    creating build/lib.linux-x86_64-2.7/quickshot/lib/capture
    copying quickshot/lib/capture/__init__.py -> build/lib.linux-x86_64-2.7/quickshot/lib/capture
    copying quickshot/__init__.py -> build/lib.linux-x86_64-2.7/quickshot
    copying quickshot/common.py -> build/lib.linux-x86_64-2.7/quickshot
    creating build/lib.linux-x86_64-2.7/quickshot/lib/server
    copying quickshot/lib/server/__init__.py -> build/lib.linux-x86_64-2.7/quickshot/lib/server
    creating build/lib.linux-x86_64-2.7/quickshot/lib/resolution
    copying quickshot/lib/resolution/__init__.py -> build/lib.linux-x86_64-2.7/quickshot/lib/resolution
    copying quickshot/lib/__init__.py -> build/lib.linux-x86_64-2.7/quickshot/lib
    creating build/lib.linux-x86_64-2.7/quickshot/gui
    copying quickshot/gui/screenshot_list.py -> build/lib.linux-x86_64-2.7/quickshot/gui
    copying quickshot/gui/user_account.py -> build/lib.linux-x86_64-2.7/quickshot/gui
    copying quickshot/gui/screenshot_compare.py -> build/lib.linux-x86_64-2.7/quickshot/gui
    copying quickshot/gui/about.py -> build/lib.linux-x86_64-2.7/quickshot/gui
    copying quickshot/gui/credits.py -> build/lib.linux-x86_64-2.7/quickshot/gui
    copying quickshot/gui/graphics_confirm.py -> build/lib.linux-x86_64-2.7/quickshot/gui
    copying quickshot/gui/licence.py -> build/lib.linux-x86_64-2.7/quickshot/gui
    copying quickshot/gui/dialogue.py -> build/lib.linux-x86_64-2.7/quickshot/gui
    copying quickshot/gui/graphics_change.py -> build/lib.linux-x86_64-2.7/quickshot/gui
    copying quickshot/gui/base.py -> build/lib.linux-x86_64-2.7/quickshot/gui
    copying quickshot/gui/__init__.py -> build/lib.linux-x86_64-2.7/quickshot/gui
    copying quickshot/gui/user_details.py -> build/lib.linux-x86_64-2.7/quickshot/gui
    copying quickshot/gui/screenshot_detail.py -> build/lib.linux-x86_64-2.7/quickshot/gui
    copying quickshot/gui/project_selection.py -> build/lib.linux-x86_64-2.7/quickshot/gui
    creating build/lib.linux-x86_64-2.7/quickshot/lib/account
    copying quickshot/lib/account/environment.py -> build/lib.linux-x86_64-2.7/quickshot/lib/account
    copying quickshot/lib/account/__init__.py -> build/lib.linux-x86_64-2.7/quickshot/lib/account
    running build_i18n
    intltool-update -p -g quickshot
    running build_icons
    running build_help
    WARNING: the following files are not recognized by DistUtilsExtra.auto:
      bin/quickshot
      hooks/quickshot-crashdb.conf
      hooks/source_quickshot.py
      quickshot.desktop
      run.sh
    running install
    ERROR: Can't find quickshot/quickshotconfig.py
    Traceback (most recent call last):
      File "setup.py", line 103, in <module>
        cmdclass={'install': InstallAndUpdateDataDirectory}
      File "/usr/lib/python2.7/dist-packages/DistUtilsExtra/auto.py", line 100, in setup
        distutils.core.setup(**attrs)
      File "/usr/lib/python2.7/distutils/core.py", line 152, in setup
        dist.run_commands()
      File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands
        self.run_command(cmd)
      File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
        cmd_obj.run()
      File "setup.py", line 83, in run
        previous_value = update_data_path(self.prefix + '/share/quickshot/')
      File "setup.py", line 54, in update_data_path
        sys.exit(1)
    NameError: global name 'sys' is not defined