def iter_supported_tags(cls, identity, platform=get_supported_platform()): """Iterate over the supported tag tuples of this interpreter. :param identity: python interpreter identity over which tags should iterate. :type identity: :class:`PythonIdentity` :param platform: python platform over which tags should iterate, by default the current platform. :returns: Iterator over valid PEP425 tag tuples. """ impl_tag = cls.get_implementation_tag(identity.interpreter) vers_tag = cls.get_version_tag(identity.version) tag_iterator = cls._iter_supported_tags(impl_tag, vers_tag, platform) for tag in tag_iterator: yield tag
def get_platform_tag(cls): return cls.translate_platform_to_tag(get_supported_platform())
def test(): # We put a "fakedependency-1.0.0.egg" package and a # "fakedependency-9.9.99.tar.gz" into a directory, but the latter is # booby-trapped so it will raise an exception when you try to build it. # # Then we run # # python setup.py --fakedependency -v test -s buildtest.test_build_with_fake_dist # # which requires "fakedependency >= 1.0.0", imports fakedependency # and passes if fakedependency.__version__ == '1.0.0'. # # The goal is to turn red if the build system tries to build the # source dist when it could have used the binary dist. # # Note that for this test to make sense, Tahoe-LAFS needs to be asking # for a version of fakedependency which can be satisfied by 1.0.0. # The --fakedependency option to setup.py arranges that. fake_distdir = 'tahoe-deps' fake_distname = "fakedependency" fake_sdistversion = "9.9.99" fake_bdistversion = "1.0.0" sdist_setup = "raise Exception('Aha I caught you trying to build me. I am a fakedependency 9.9.99 sdist and you should be satisfied with a bdist.')" testsuite = "buildtest.test_build_with_fake_dist" dist_dirname = os.path.join(os.getcwd(), fake_distdir) try: os.makedirs(dist_dirname) except OSError: # probably already exists pass bdist_egg_name = os.path.join(dist_dirname, '%s-%s-py%s.%s-%s.egg' % (fake_distname, fake_bdistversion, platform.python_version_tuple()[0], platform.python_version_tuple()[1], pkg_resources.get_supported_platform())) try: bdist_egg = zipfile.ZipFile(bdist_egg_name, 'w') bdist_egg.writestr('fakedependency/__init__.py', '__version__ = "%s"\n' % (fake_bdistversion,)) bdist_egg.close() sdist_name = os.path.join(dist_dirname, '%s-%s.tar' % (fake_distname, fake_sdistversion)) sdist = tarfile.open(sdist_name, 'w:gz') sdist.errorlevel = 2 tarinfo = tarfile.TarInfo('setup.py') tarinfo.errorlevel = 2 tarinfo.size = len(sdist_setup) sdist.addfile(tarinfo, StringIO.StringIO(sdist_setup)) sdist.close() sys.exit(subprocess.call([sys.executable, "setup.py", "--fakedependency", "-v", "test", "-s", testsuite], env=os.environ)) finally: os.remove(bdist_egg_name) os.remove(sdist_name) cleanup()
import StringIO import ConfigParser import argparse import MySQLdb from launchpadlib.launchpad import Launchpad from launchpadlib.uris import LPNET_SERVICE_ROOT from openid.consumer import consumer from openid.cryptutil import randomString DEBUG = False # suppress pyflakes pkg_resources.get_supported_platform() pid_file = '/tmp/update_gerrit_users.pid' fp = open(pid_file, 'w') try: fcntl.lockf(fp, fcntl.LOCK_EX | fcntl.LOCK_NB) except IOError: # another instance is running sys.exit(0) parser = argparse.ArgumentParser() parser.add_argument('user', help='The gerrit admin user') parser.add_argument('ssh_key', help='The gerrit admin SSH key file') parser.add_argument('site', help='The site in use (typically openstack or stackforge)') parser.add_argument('root_team', help='The root launchpad team to pull from') parser.add_argument('log_config', default=None, help='Path to file containing logging config')
def current(): return get_supported_platform()
def current(): return pkg_resources.get_supported_platform()
# so if we head it off at the pass, we can skip cronspam import pkg_resources import argparse import ConfigParser import MySQLdb import StringIO from launchpadlib.launchpad import Launchpad from launchpadlib.uris import LPNET_SERVICE_ROOT from openid.consumer import consumer from openid.cryptutil import randomString # suppress pyflakes pkg_resources.get_supported_platform() pid_file = '/tmp/update_gerrit_users.pid' fp = open(pid_file, 'w') try: fcntl.lockf(fp, fcntl.LOCK_EX | fcntl.LOCK_NB) except IOError: # another instance is running sys.exit(0) parser = argparse.ArgumentParser() parser.add_argument('user', help='The gerrit admin user') parser.add_argument('ssh_key', help='The gerrit admin SSH key file') parser.add_argument('log_config', default=None, nargs='?', help='Path to file containing logging config') parser.add_argument('--prep-only', action='store_true')
def test(): # We put a "fakedependency-1.0.0.egg" package and a # "fakedependency-9.9.99.tar.gz" into a directory, but the latter is # booby-trapped so it will raise an exception when you try to build it. # # Then we run # # python setup.py --fakedependency -v test -s buildtest.test_build_with_fake_dist # # which imports fakedependency and passes if fakedependency.__version__ == '1.0.0'. # # The goal is to turn red if the build system tries to build the # source dist when it could have used the binary dist. # # Note that for this test to make sense, Tahoe-LAFS needs to be asking # for a version of fakedependency which can be satisfied by 1.0.0. # The --fakedependency option to setup.py arranges that. fake_distdir = 'tahoe-deps' fake_distname = "fakedependency" fake_sdistversion = "9.9.99" fake_bdistversion = "1.0.0" sdist_setup = "raise Exception('Aha I caught you trying to build me. I am a fakedependency 9.9.99 sdist and you should be satisfied with a bdist.')" testsuite = "buildtest.test_build_with_fake_dist" dist_dirname = os.path.join(os.getcwd(), fake_distdir) try: os.makedirs(dist_dirname) except OSError: # probably already exists pass bdist_egg_name = os.path.join( dist_dirname, '%s-%s-py%s.%s-%s.egg' % (fake_distname, fake_bdistversion, platform.python_version_tuple()[0], platform.python_version_tuple()[1], pkg_resources.get_supported_platform())) try: bdist_egg = zipfile.ZipFile(bdist_egg_name, 'w') bdist_egg.writestr('fakedependency/__init__.py', '__version__ = "%s"\n' % (fake_bdistversion, )) bdist_egg.close() sdist_name = os.path.join( dist_dirname, '%s-%s.tar' % (fake_distname, fake_sdistversion)) sdist = tarfile.open(sdist_name, 'w:gz') sdist.errorlevel = 2 tarinfo = tarfile.TarInfo('setup.py') tarinfo.errorlevel = 2 tarinfo.size = len(sdist_setup) sdist.addfile(tarinfo, StringIO.StringIO(sdist_setup)) sdist.close() sys.exit( subprocess.call([ sys.executable, "setup.py", "--fakedependency", "-v", "test", "-s", testsuite ], env=os.environ)) finally: os.remove(bdist_egg_name) os.remove(sdist_name) cleanup()
def test(): # We put a fake "pycryptopp-0.5.24.egg" package and a fake # "pycryptopp-9.9.99.tar.gz" into a directory, but the latter is # booby-trapped so it will raise an exception when you try to build # it. # Then we run "python setup.py test -s # buildtest.test_with_fake_dist", which imports pycryptopp # and passes if pycryptopp.__version__ == '0.5.24'. # (If building succeeded -- meaning that you didn't try to build the # booby-trapped 9.9.99 -- but pycryptopp.__version__ != '0.5.24' then # that means a different version of pycryptopp was already installed # so neither of the two fake pycryptopp packages were needed. In that # case this test should be treated as a "skip" -- the functionality # under test can't be exercised on the current system.) # The goal is to turn red if the build system tries to build the # source dist when it could have used the binary dist. # (Note that for this test to make sense, tahoe-lafs needs to be # asking for a version of pycryptopp which can be satisfied by either # 0.5.24 or 0.5.25. At the time of this writing it requires >= 0.5.20 # on x86 and >= 0.5.14 on other architectures.) fake_distdir = 'tahoe-deps' fake_distname = "pycryptopp" fake_sdistversion = "9.9.99" fake_bdistversion = "0.5.24" sdist_setup = "raise Exception('Aha I caught you trying to build me. I am a fake pycryptopp 9.9.99 sdist and you should be satisfied with a bdist.')" testsuite = "buildtest.test_build_with_fake_dist" dist_dirname = os.path.join(os.getcwd(), fake_distdir) try: os.makedirs(dist_dirname) except OSError: # probably already exists pass bdist_egg_name = os.path.join(dist_dirname, '%s-%s-py%s.%s-%s.egg' % (fake_distname, fake_bdistversion, platform.python_version_tuple()[0], platform.python_version_tuple()[1], pkg_resources.get_supported_platform())) try: bdist_egg = zipfile.ZipFile(bdist_egg_name, 'w') bdist_egg.writestr('pycryptopp/__init__.py', '__version__ = "%s"\n' % (fake_bdistversion,)) bdist_egg.close() sdist_name = os.path.join(dist_dirname, '%s-%s.tar' % (fake_distname, fake_sdistversion)) sdist = tarfile.open(sdist_name, 'w:gz') sdist.errorlevel =2 tarinfo = tarfile.TarInfo('setup.py') tarinfo.errorlevel =2 tarinfo.size = len(sdist_setup) sdist.addfile(tarinfo, StringIO.StringIO(sdist_setup)) sdist.close() sys.exit(subprocess.call([sys.executable, "setup.py", "-v", "test", "-s", testsuite], env=os.environ)) finally: os.remove(bdist_egg_name) os.remove(sdist_name) cleanup()