Пример #1
0
 def test_options(self, test='testoptions'):
     builddir = udir.ensure("build", dir=True)
     retval, builddir = package.package(
         '--without-cffi', '--builddir', str(builddir),
         '--archive-name', test,
         '--rename_pypy_c', self.rename_pypy_c,
         _fake=True)
Пример #2
0
def test_dir_structure(test="test"):
    # make sure we have sort of pypy-c
    if sys.platform == "win32":
        basename = "pypy-c.exe"
        rename_pypy_c = "pypy-c"
        exe_name_in_archive = "pypy-c.exe"
    else:
        basename = "pypy-c"
        rename_pypy_c = "pypy"
        exe_name_in_archive = "bin/pypy"
    pypy_c = py.path.local(pypydir).join("translator", "goal", basename)
    if not pypy_c.check():
        os.system("echo faked_pypy_c> %s" % (pypy_c,))
        pypy_c.chmod(0755)
        fake_pypy_c = True
    else:
        fake_pypy_c = False
    try:
        builddir = package.package(py.path.local(pypydir).dirpath(), test, rename_pypy_c)
        prefix = builddir.join(test)
        cpyver = "%d.%d" % CPYTHON_VERSION[:2]
        assert prefix.join("lib-python", cpyver, "test").check()
        assert prefix.join(exe_name_in_archive).check()
        assert prefix.join("lib_pypy", "syslog.py").check()
        assert not prefix.join("lib_pypy", "py").check()
        assert not prefix.join("lib_pypy", "ctypes_configure").check()
        assert prefix.join("LICENSE").check()
        assert prefix.join("README").check()
        if package.USE_ZIPFILE_MODULE:
            zh = zipfile.ZipFile(str(builddir.join("%s.zip" % test)))
            assert zh.open("%s/lib_pypy/syslog.py" % test)
        else:
            th = tarfile.open(str(builddir.join("%s.tar.bz2" % test)))
            syslog = th.getmember("%s/lib_pypy/syslog.py" % test)
            exe = th.getmember("%s/%s" % (test, exe_name_in_archive))
            assert syslog.mode == 0644
            assert exe.mode == 0755
            assert exe.uname == ""
            assert exe.gname == ""
            assert exe.uid == 0
            assert exe.gid == 0

        # the headers file could be not there, because they are copied into
        # trunk/include only during translation
        includedir = py.path.local(pypydir).dirpath().join("include")

        def check_include(name):
            if includedir.join(name).check(file=True):
                member = "%s/include/%s" % (test, name)
                if package.USE_ZIPFILE_MODULE:
                    assert zh.open(member)
                else:
                    assert th.getmember(member)

        check_include("Python.h")
        check_include("modsupport.h")
        check_include("pypy_decl.h")
    finally:
        if fake_pypy_c:
            pypy_c.remove()
Пример #3
0
    def test_dir_structure(self, test='test'):
        retval, builddir = package.package('--without-cffi',
                                           '--archive-name',
                                           test,
                                           '--rename_pypy_c',
                                           self.rename_pypy_c,
                                           _fake=True)
        assert retval == 0
        prefix = builddir.join(test)
        cpyver = '%d.%d' % CPYTHON_VERSION[:2]
        assert prefix.join('lib-python', cpyver, 'test').check()
        assert prefix.join(self.exe_name_in_archive).check()
        assert prefix.join('lib_pypy', 'syslog.py').check()
        assert not prefix.join('lib_pypy', 'py').check()
        assert not prefix.join('lib_pypy', 'ctypes_configure').check()
        assert prefix.join('LICENSE').check()
        assert prefix.join('README.rst').check()
        if package.USE_ZIPFILE_MODULE:
            zh = zipfile.ZipFile(str(builddir.join('%s.zip' % test)))
            assert zh.open('%s/lib_pypy/syslog.py' % test)
        else:
            th = tarfile.open(str(builddir.join('%s.tar.bz2' % test)))
            syslog = th.getmember('%s/lib_pypy/syslog.py' % test)
            exe = th.getmember('%s/%s' % (test, self.exe_name_in_archive))
            assert syslog.mode == 0644
            assert exe.mode == 0755
            assert exe.uname == ''
            assert exe.gname == ''
            # The tar program on MacOSX or the FreeBSDs does not support
            # setting the numeric uid and gid when creating a tar file.
            if not (sys.platform == 'darwin'
                    or sys.platform.startswith('freebsd')):
                assert exe.uid == 0
                assert exe.gid == 0

        # the headers file could be not there, because they are copied into
        # trunk/include only during translation
        includedir = py.path.local(pypydir).dirpath().join('include')

        def check_include(name):
            if includedir.join(name).check(file=True):
                member = '%s/include/%s' % (test, name)
                if package.USE_ZIPFILE_MODULE:
                    assert zh.open(member)
                else:
                    assert th.getmember(member)
            else:
                print 'include file "%s" not found, are we translated?' % includedir.join(
                    name)

        check_include('Python.h')
        check_include('modsupport.h')
        check_include('pypy_decl.h')
        check_include('numpy/arrayobject.h')
Пример #4
0
 def test_options(self, test="testoptions"):
     builddir = udir.ensure("build", dir=True)
     retval, builddir = package.package(
         "--without-cffi",
         "--builddir",
         str(builddir),
         "--archive-name",
         test,
         "--rename_pypy_c",
         self.rename_pypy_c,
         _fake=True,
     )
Пример #5
0
    def test_dir_structure(self, test="test"):
        retval, builddir = package.package(
            "--without-cffi", "--archive-name", test, "--rename_pypy_c", self.rename_pypy_c, _fake=True
        )
        assert retval == 0
        prefix = builddir.join(test)
        cpyver = "%d.%d" % CPYTHON_VERSION[:2]
        assert prefix.join("lib-python", cpyver, "test").check()
        assert prefix.join(self.exe_name_in_archive).check()
        assert prefix.join("lib_pypy", "syslog.py").check()
        assert not prefix.join("lib_pypy", "py").check()
        assert not prefix.join("lib_pypy", "ctypes_configure").check()
        assert prefix.join("LICENSE").check()
        assert prefix.join("README.rst").check()
        if package.USE_ZIPFILE_MODULE:
            zh = zipfile.ZipFile(str(builddir.join("%s.zip" % test)))
            assert zh.open("%s/lib_pypy/syslog.py" % test)
        else:
            th = tarfile.open(str(builddir.join("%s.tar.bz2" % test)))
            syslog = th.getmember("%s/lib_pypy/syslog.py" % test)
            exe = th.getmember("%s/%s" % (test, self.exe_name_in_archive))
            assert syslog.mode == 0644
            assert exe.mode == 0755
            assert exe.uname == ""
            assert exe.gname == ""
            # The tar program on MacOSX or the FreeBSDs does not support
            # setting the numeric uid and gid when creating a tar file.
            if not (sys.platform == "darwin" or sys.platform.startswith("freebsd")):
                assert exe.uid == 0
                assert exe.gid == 0

        # the headers file could be not there, because they are copied into
        # trunk/include only during translation
        includedir = py.path.local(pypydir).dirpath().join("include")

        def check_include(name):
            if includedir.join(name).check(file=True):
                member = "%s/include/%s" % (test, name)
                if package.USE_ZIPFILE_MODULE:
                    assert zh.open(member)
                else:
                    assert th.getmember(member)
            else:
                print 'include file "%s" not found, are we translated?' % includedir.join(name)

        check_include("Python.h")
        check_include("modsupport.h")
        check_include("pypy_decl.h")
        check_include("numpy/arrayobject.h")
Пример #6
0
    def test_dir_structure(self, test='test'):
        retval, builddir = package.package(
            '--without-cffi', str(py.path.local(pypydir).dirpath()),
            test, self.rename_pypy_c, _fake=True)
        assert retval == 0
        prefix = builddir.join(test)
        cpyver = '%d.%d' % CPYTHON_VERSION[:2]
        assert prefix.join('lib-python', cpyver, 'test').check()
        assert prefix.join(self.exe_name_in_archive).check()
        assert prefix.join('lib_pypy', 'syslog.py').check()
        assert not prefix.join('lib_pypy', 'py').check()
        assert not prefix.join('lib_pypy', 'ctypes_configure').check()
        assert prefix.join('LICENSE').check()
        assert prefix.join('README.rst').check()
        if package.USE_ZIPFILE_MODULE:
            zh = zipfile.ZipFile(str(builddir.join('%s.zip' % test)))
            assert zh.open('%s/lib_pypy/syslog.py' % test)
        else:
            th = tarfile.open(str(builddir.join('%s.tar.bz2' % test)))
            syslog = th.getmember('%s/lib_pypy/syslog.py' % test)
            exe = th.getmember('%s/%s' % (test, self.exe_name_in_archive))
            assert syslog.mode == 0644
            assert exe.mode == 0755
            assert exe.uname == ''
            assert exe.gname == ''
            # The tar program on MacOSX or the FreeBSDs does not support
            # setting the numeric uid and gid when creating a tar file.
            if not(sys.platform == 'darwin' or sys.platform.startswith('freebsd')):
                assert exe.uid == 0
                assert exe.gid == 0

        # the headers file could be not there, because they are copied into
        # trunk/include only during translation
        includedir = py.path.local(pypydir).dirpath().join('include')
        def check_include(name):
            if includedir.join(name).check(file=True):
                member = '%s/include/%s' % (test, name)
                if package.USE_ZIPFILE_MODULE:
                    assert zh.open(member)
                else:
                    assert th.getmember(member)
            else:
                print 'include file "%s" not found, are we translated?' % includedir.join(name)
        check_include('Python.h')
        check_include('modsupport.h')
        check_include('pypy_decl.h')
        check_include('numpy/arrayobject.h')
Пример #7
0
def test_dir_structure(test='test'):
    # make sure we have sort of pypy-c
    if sys.platform == 'win32':
        basename = 'pypy-c.exe'
        rename_pypy_c = 'pypy-c'
        exe_name_in_archive = 'pypy-c.exe'
    else:
        basename = 'pypy-c'
        rename_pypy_c = 'pypy'
        exe_name_in_archive = 'bin/pypy'
    pypy_c = py.path.local(pypydir).join('goal', basename)
    if not pypy_c.check():
        if sys.platform == 'win32':
            import os, shutil
            for d in os.environ['PATH'].split(';'):
                if os.path.exists(os.path.join(d, 'cmd.exe')):
                    shutil.copy(os.path.join(d, 'cmd.exe'), str(pypy_c))
                    break
            else:
                assert False, 'could not find cmd.exe'
        else:
            pypy_c.write("#!/bin/sh")
            pypy_c.chmod(0755)
        fake_pypy_c = True
    else:
        fake_pypy_c = False
    try:
        retval, builddir = package.package(py.path.local(pypydir).dirpath(), test,
                                   rename_pypy_c)
        assert retval == 0
        prefix = builddir.join(test)
        cpyver = '%d.%d' % CPYTHON_VERSION[:2]
        assert prefix.join('lib-python', cpyver, 'test').check()
        assert prefix.join(exe_name_in_archive).check()
        assert prefix.join('lib_pypy', 'syslog.py').check()
        assert not prefix.join('lib_pypy', 'py').check()
        assert not prefix.join('lib_pypy', 'ctypes_configure').check()
        assert prefix.join('LICENSE').check()
        assert prefix.join('README.rst').check()
        if package.USE_ZIPFILE_MODULE:
            zh = zipfile.ZipFile(str(builddir.join('%s.zip' % test)))
            assert zh.open('%s/lib_pypy/syslog.py' % test)
        else:
            th = tarfile.open(str(builddir.join('%s.tar.bz2' % test)))
            syslog = th.getmember('%s/lib_pypy/syslog.py' % test)
            exe = th.getmember('%s/%s' % (test, exe_name_in_archive))
            assert syslog.mode == 0644
            assert exe.mode == 0755
            assert exe.uname == ''
            assert exe.gname == ''
            # The tar program on MacOSX or the FreeBSDs does not support
            # setting the numeric uid and gid when creating a tar file.
            if not(sys.platform == 'darwin' or sys.platform.startswith('freebsd')):
                assert exe.uid == 0
                assert exe.gid == 0

        # the headers file could be not there, because they are copied into
        # trunk/include only during translation
        includedir = py.path.local(pypydir).dirpath().join('include')
        def check_include(name):
            if includedir.join(name).check(file=True):
                member = '%s/include/%s' % (test, name)
                if package.USE_ZIPFILE_MODULE:
                    assert zh.open(member)
                else:
                    assert th.getmember(member)
            else:
                print 'include file "%s" not found, are we translated?' % includedir.join(name)
        check_include('Python.h')
        check_include('modsupport.h')
        check_include('pypy_decl.h')
        check_include('numpy/arrayobject.h')
    finally:
        if fake_pypy_c:
            pypy_c.remove()
Пример #8
0
 def test_options(self, test='testoptions'):
     builddir = udir.ensure("build", dir=True)
     retval, builddir = package.package(
         '--without-cffi', '--builddir', str(builddir),
         str(py.path.local(pypydir).dirpath()),
         test, self.rename_pypy_c, _fake=True)
Пример #9
0
def test_dir_structure(test='test'):
    # make sure we have sort of pypy-c
    if sys.platform == 'win32':
        basename = 'pypy-c.exe'
        rename_pypy_c = 'pypy-c'
        exe_name_in_archive = 'pypy-c.exe'
    else:
        basename = 'pypy-c'
        rename_pypy_c = 'pypy'
        exe_name_in_archive = 'bin/pypy'
    pypy_c = py.path.local(pypydir).join('translator', 'goal', basename)
    if not pypy_c.check():
        os.system("echo faked_pypy_c> %s" % (pypy_c, ))
        pypy_c.chmod(0755)
        fake_pypy_c = True
    else:
        fake_pypy_c = False
    try:
        builddir = package.package(
            py.path.local(pypydir).dirpath(), test, rename_pypy_c)
        prefix = builddir.join(test)
        cpyver = '%d.%d' % CPYTHON_VERSION[:2]
        assert prefix.join('lib-python', cpyver, 'test').check()
        assert prefix.join(exe_name_in_archive).check()
        assert prefix.join('lib_pypy', 'syslog.py').check()
        assert not prefix.join('lib_pypy', 'py').check()
        assert not prefix.join('lib_pypy', 'ctypes_configure').check()
        assert prefix.join('LICENSE').check()
        assert prefix.join('README').check()
        if package.USE_ZIPFILE_MODULE:
            zh = zipfile.ZipFile(str(builddir.join('%s.zip' % test)))
            assert zh.open('%s/lib_pypy/syslog.py' % test)
        else:
            th = tarfile.open(str(builddir.join('%s.tar.bz2' % test)))
            syslog = th.getmember('%s/lib_pypy/syslog.py' % test)
            exe = th.getmember('%s/%s' % (test, exe_name_in_archive))
            assert syslog.mode == 0644
            assert exe.mode == 0755
            assert exe.uname == ''
            assert exe.gname == ''
            assert exe.uid == 0
            assert exe.gid == 0

        # the headers file could be not there, because they are copied into
        # trunk/include only during translation
        includedir = py.path.local(pypydir).dirpath().join('include')

        def check_include(name):
            if includedir.join(name).check(file=True):
                member = '%s/include/%s' % (test, name)
                if package.USE_ZIPFILE_MODULE:
                    assert zh.open(member)
                else:
                    assert th.getmember(member)

        check_include('Python.h')
        check_include('modsupport.h')
        check_include('pypy_decl.h')
    finally:
        if fake_pypy_c:
            pypy_c.remove()
Пример #10
0
def test_dir_structure(test='test'):
    # make sure we have sort of pypy-c
    if sys.platform == 'win32':
        basename = 'pypy-c.exe'
        rename_pypy_c = 'pypy-c'
        exe_name_in_archive = 'pypy-c.exe'
    else:
        basename = 'pypy-c'
        rename_pypy_c = 'pypy'
        exe_name_in_archive = 'bin/pypy'
    pypy_c = py.path.local(pypydir).join('goal', basename)
    if not pypy_c.check():
        if sys.platform == 'win32':
            import os, shutil
            for d in os.environ['PATH'].split(';'):
                if os.path.exists(os.path.join(d, 'cmd.exe')):
                    shutil.copy(os.path.join(d, 'cmd.exe'), str(pypy_c))
                    break
            else:
                assert False, 'could not find cmd.exe'
        else:
            pypy_c.write("#!/bin/sh")
            pypy_c.chmod(0755)
        fake_pypy_c = True
    else:
        fake_pypy_c = False
    try:
        retval, builddir = package.package(
            py.path.local(pypydir).dirpath(), test, rename_pypy_c)
        assert retval == 0
        prefix = builddir.join(test)
        cpyver = '%d.%d' % CPYTHON_VERSION[:2]
        assert prefix.join('lib-python', cpyver, 'test').check()
        assert prefix.join(exe_name_in_archive).check()
        assert prefix.join('lib_pypy', 'syslog.py').check()
        assert not prefix.join('lib_pypy', 'py').check()
        assert not prefix.join('lib_pypy', 'ctypes_configure').check()
        assert prefix.join('LICENSE').check()
        assert prefix.join('README.rst').check()
        if package.USE_ZIPFILE_MODULE:
            zh = zipfile.ZipFile(str(builddir.join('%s.zip' % test)))
            assert zh.open('%s/lib_pypy/syslog.py' % test)
        else:
            th = tarfile.open(str(builddir.join('%s.tar.bz2' % test)))
            syslog = th.getmember('%s/lib_pypy/syslog.py' % test)
            exe = th.getmember('%s/%s' % (test, exe_name_in_archive))
            assert syslog.mode == 0644
            assert exe.mode == 0755
            assert exe.uname == ''
            assert exe.gname == ''
            # The tar program on MacOSX or the FreeBSDs does not support
            # setting the numeric uid and gid when creating a tar file.
            if not (sys.platform == 'darwin'
                    or sys.platform.startswith('freebsd')):
                assert exe.uid == 0
                assert exe.gid == 0

        # the headers file could be not there, because they are copied into
        # trunk/include only during translation
        includedir = py.path.local(pypydir).dirpath().join('include')

        def check_include(name):
            if includedir.join(name).check(file=True):
                member = '%s/include/%s' % (test, name)
                if package.USE_ZIPFILE_MODULE:
                    assert zh.open(member)
                else:
                    assert th.getmember(member)
            else:
                print 'include file "%s" not found, are we translated?' % includedir.join(
                    name)

        check_include('Python.h')
        check_include('modsupport.h')
        check_include('pypy_decl.h')
        check_include('numpy/arrayobject.h')
    finally:
        if fake_pypy_c:
            pypy_c.remove()