コード例 #1
0
 def start(self):
     assert self.id is None, 'Session already started'
     # The Travis CI tests transgrade from Ubuntu to Debian, so first look
     # in various environment variables to see if the arch and distro are
     # overridden.  If not, figure out some defaults.
     arch = os.environ.get('CH_ARCH')
     distro = os.environ.get('CH_DISTRO')
     if arch is None:
         arch = output('dpkg-architecture -q DEB_HOST_ARCH').strip()
     if distro is None:
         distro = output('lsb_release -cs').strip()
     chroot_name = 'dirtbike-{}-{}'.format(distro, arch)
     self.id = output(
         ['schroot', '-u', 'root', '-c', chroot_name,
          '--begin-session']).strip()
コード例 #2
0
ファイル: schroot.py プロジェクト: paulproteus/dirtbike
 def start(self):
     assert self.id is None, 'Session already started'
     # The Travis CI tests transgrade from Ubuntu to Debian, so first look
     # in various environment variables to see if the arch and distro are
     # overridden.  If not, figure out some defaults.
     arch = os.environ.get('CH_ARCH')
     distro = os.environ.get('CH_DISTRO')
     if arch is None:
         arch = output('dpkg-architecture -q DEB_HOST_ARCH').strip()
     if distro is None:
         distro = output('lsb_release -cs').strip()
     chroot_name = 'dirtbike-{}-{}'.format(distro, arch)
     self.id = output(
         ['schroot', '-u', 'root', '-c', chroot_name, '--begin-session']
         ).strip()
コード例 #3
0
 def test_sanity_check_wheel(self):
     # Sanity check that the setUpClass() created the wheel, that it can be
     # pip installed in a temporary directory, and that with only the
     # installed package on sys.path, the package can be imported and run.
     dist_dir = temporary_directory()
     self.addCleanup(dist_dir.cleanup)
     with chdir(self.example_dir):
         call([
             sys.executable,
             'setup.py',
             '--no-user-cfg',
             'bdist_wheel',
             '--universal',
             '--dist-dir',
             dist_dir.name,
         ])
     wheels = glob(os.path.join(dist_dir.name, '*.whl'))
     self.assertEqual(len(wheels), 1)
     wheel = wheels[0]
     with temporary_directory() as tempdir:
         call(['pip', 'install', '--target', tempdir, wheel])
         result = output(
             [sys.executable, '-c', 'import stupid; stupid.yes()'],
             env=dict(PYTHONPATH=tempdir))
     self.assertEqual(result, 'yes\n')
コード例 #4
0
 def output(self, command, **kws):
     assert self.id is not None, 'No schroot session'
     if isinstance(command, str):
         command = command.split()
     session_cmd = ['schroot', '-u', 'root', '-rc', self.id, '--']
     if 'env' in kws:
         session_cmd.insert(-1, '--preserve-environment')
     session_cmd.extend(command)
     return output(session_cmd, **kws)
コード例 #5
0
ファイル: schroot.py プロジェクト: paulproteus/dirtbike
 def output(self, command, **kws):
     assert self.id is not None, 'No schroot session'
     if isinstance(command, str):
         command = command.split()
     session_cmd = ['schroot', '-u', 'root', '-rc', self.id, '--']
     if 'env' in kws:
         session_cmd.insert(-1, '--preserve-environment')
     session_cmd.extend(command)
     return output(session_cmd, **kws)
コード例 #6
0
ファイル: test_dirtbike.py プロジェクト: paulproteus/dirtbike
 def test_sanity_check_wheel(self):
     # Sanity check that the setUpClass() created the wheel, that it can be
     # pip installed in a temporary directory, and that with only the
     # installed package on sys.path, the package can be imported and run.
     dist_dir = temporary_directory()
     self.addCleanup(dist_dir.cleanup)
     with chdir(self.example_dir):
         call([
             sys.executable,
             'setup.py', '--no-user-cfg',
             'bdist_wheel', '--universal',
             '--dist-dir', dist_dir.name,
             ])
     wheels = glob(os.path.join(dist_dir.name, '*.whl'))
     self.assertEqual(len(wheels), 1)
     wheel = wheels[0]
     with temporary_directory() as tempdir:
         call(['pip', 'install', '--target', tempdir, wheel])
         result = output(
             [sys.executable, '-c', 'import stupid; stupid.yes()'],
             env=dict(PYTHONPATH=tempdir))
     self.assertEqual(result, 'yes\n')