Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test_disutils fails #47304

Closed
ronaldoussoren opened this issue Jun 6, 2008 · 6 comments
Closed

test_disutils fails #47304

ronaldoussoren opened this issue Jun 6, 2008 · 6 comments
Labels
tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error

Comments

@ronaldoussoren
Copy link
Contributor

BPO 3054
Nosy @ronaldoussoren, @nascheme
Files
  • test_build_ext.patch
  • get_python_inc.patch
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2009-12-26.13:18:12.311>
    created_at = <Date 2008-06-06.21:34:17.714>
    labels = ['type-bug', 'tests']
    title = 'test_disutils fails'
    updated_at = <Date 2009-12-26.13:18:12.310>
    user = 'https://github.com/ronaldoussoren'

    bugs.python.org fields:

    activity = <Date 2009-12-26.13:18:12.310>
    actor = 'ronaldoussoren'
    assignee = 'none'
    closed = True
    closed_date = <Date 2009-12-26.13:18:12.311>
    closer = 'ronaldoussoren'
    components = ['Tests']
    creation = <Date 2008-06-06.21:34:17.714>
    creator = 'ronaldoussoren'
    dependencies = []
    files = ['10543', '10663']
    hgrepos = []
    issue_num = 3054
    keywords = ['patch']
    message_count = 6.0
    messages = ['67785', '67807', '68423', '68430', '68436', '96888']
    nosy_count = 3.0
    nosy_names = ['ronaldoussoren', 'nas', 'spatz']
    pr_nums = []
    priority = 'high'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue3054'
    versions = ['Python 2.6', 'Python 3.0']

    @ronaldoussoren
    Copy link
    Contributor Author

    test_distutils fails when you're not building in the root of the source
    tree.

    That is:

    mkdir build
    cd build
    ../configure
    make
    make check

    This fails like this:

    test test_distutils failed -- Traceback (most recent call last):
      File "/Users/ronald/Projects/python/python-
    trunk/Lib/distutils/tests/test_build_ext.py", line 23, in setUp
        shutil.copy(xx_c, self.tmp_dir)
      File "/Users/ronald/Projects/python/python-trunk/Lib/shutil.py", line 
    82, in copy
        copyfile(src, dst)
      File "/Users/ronald/Projects/python/python-trunk/Lib/shutil.py", line 
    46, in copyfile
        fsrc = open(src, 'rb')
    IOError: [Errno 2] No such file or directory: 
    '/Users/ronald/Projects/python/python-trunk/build104/Modules/xxmodule.c'

    @ronaldoussoren ronaldoussoren added stdlib Python modules in the Lib dir tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error and removed stdlib Python modules in the Lib dir labels Jun 6, 2008
    @spatz
    Copy link
    Mannequin

    spatz mannequin commented Jun 7, 2008

    This also happens in py3k.
    Attached a patch that fixes this by using the dirname of
    sysconfig.project_base if the file is not found, but perhaps a better
    solution could be found...

    @nascheme
    Copy link
    Member

    Looks like this has exposed some ugly code. From setup.py:

    # Figure out the location of the source code for extension modules
    # (This logic is copied in distutils.test.test_sysconfig,
    # so building in a separate directory does not break test_distutils.)

    I believe the proper fix is to move some of the code from setup.py into
    sysconfig so that it does more than just set "python_build" when running
    inside a Python build directory. For example, it should also add
    <srcdir>/Include to the standard list of includes that distutils uses.

    The attached patch fixes test_build_ext.py to use the right source file
    (perhaps it should be tested on Windows). The test still fails because
    Python.h cannot be found.

    @nascheme
    Copy link
    Member

    I think my previous patch combined with sysconfig_builddir.patch fixes
    this issue. Someone will need to test on other platforms. Note that
    the messy code in setup.py and in the tests should still be cleaned up.

    BTW, distutils is a den of stinking evil. ;-)

    @nascheme
    Copy link
    Member

    One final patch for today (get_python_inc.patch). The patch combines my
    previous two patches and also cleans up some ugly code in setup.py and
    test_sysconfig.py. The source of the ugliness was that get_python_inc()
    did not work when running from within a build directory. The patch also
    fixes the header dependency feature introduced in svn r60287 (it assumed
    that builddir == srcdir and also that os.path.sep == '/').

    @ronaldoussoren
    Copy link
    Contributor Author

    This issue is fixed in the 2.7 and 3.2 trees.

    I'm therefore closing this issue.

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants