Ejemplo n.º 1
0
 def test_binary(self):
     with open(self.tmpfname, "wb") as fo:
         fo.write(b"\x7fELF.../some-placeholder/lib/libfoo.so\0")
     update_prefix(self.tmpfname, "/usr/local", placeholder="/some-placeholder", mode="binary")
     with open(self.tmpfname, "rb") as fi:
         data = fi.read()
         self.assertEqual(data, b"\x7fELF.../usr/local/lib/libfoo.so\0\0\0\0\0\0\0\0")
Ejemplo n.º 2
0
 def test_default_text(self):
     with open(self.tmpfname, "w") as fo:
         fo.write("#!/opt/anaconda1anaconda2anaconda3/bin/python\n" 'echo "Hello"\n')
     update_prefix(self.tmpfname, "/usr/local")
     with open(self.tmpfname, "r") as fi:
         data = fi.read()
         self.assertEqual(data, "#!/usr/local/bin/python\n" 'echo "Hello"\n')
Ejemplo n.º 3
0
 def test_long_default_text(self):
     with open(self.tmpfname, "w") as fo:
         fo.write("#!/opt/anaconda1anaconda2anaconda3/bin/python -O\n" 'echo "Hello"\n')
     new_prefix = "/usr/local/{0}".format("1234567890" * 12)
     update_prefix(self.tmpfname, new_prefix)
     with open(self.tmpfname, "r") as fi:
         data = fi.read()
         self.assertEqual(data, "#!/usr/bin/env python -O\n" 'echo "Hello"\n')
Ejemplo n.º 4
0
 def test_default_text(self):
     with open(self.tmpfname, 'w') as fo:
         fo.write('#!/opt/anaconda1anaconda2anaconda3/bin/python\n'
                  'echo "Hello"\n')
     update_prefix(self.tmpfname, '/usr/local')
     with open(self.tmpfname, 'r') as fi:
         data = fi.read()
         self.assertEqual(data, '#!/usr/local/bin/python\n'
                                'echo "Hello"\n')
Ejemplo n.º 5
0
 def test_binary(self):
     with open(self.tmpfname, 'wb') as fo:
         fo.write(b'\x7fELF.../some-placeholder/lib/libfoo.so\0')
     update_prefix(self.tmpfname, '/usr/local',
                   placeholder='/some-placeholder', mode='binary')
     with open(self.tmpfname, 'rb') as fi:
         data = fi.read()
         self.assertEqual(data,
                   b'\x7fELF.../usr/local/lib/libfoo.so\0\0\0\0\0\0\0\0')
Ejemplo n.º 6
0
 def test_long_default_text(self):
     with open(self.tmpfname, 'w') as fo:
         fo.write('#!/opt/anaconda1anaconda2anaconda3/bin/python -O\n'
                  'echo "Hello"\n')
     new_prefix = '/usr/local/{0}'.format('1234567890'*12)
     update_prefix(self.tmpfname, new_prefix)
     with open(self.tmpfname, 'r') as fi:
         data = fi.read()
         self.assertEqual(data, '#!/usr/bin/env python -O\n'
                                'echo "Hello"\n')
Ejemplo n.º 7
0
 def test_binary(self):
     with open(self.tmpfname, 'wb') as fo:
         fo.write(b'\x7fELF.../some-placeholder/lib/libfoo.so\0')
     update_prefix(self.tmpfname, '/usr/local',
                   placeholder='/some-placeholder', mode=FileMode.binary)
     with open(self.tmpfname, 'rb') as fi:
         data = fi.read()
         self.assertEqual(
             data,
             b'\x7fELF.../usr/local/lib/libfoo.so\0\0\0\0\0\0\0\0'
         )