def make_trivial_sdist(dist_path, setup_py):
 setup_py_file = tarfile.TarInfo(name='setup.py')
 try:
  MemFile = BytesIO
 except AttributeError:
  MemFile = StringIO
 setup_py_bytes = MemFile(setup_py.encode('utf-8'))
 setup_py_file.size = len(setup_py_bytes.getvalue())
 dist = tarfile.open(dist_path, 'w:gz')
 try:
  dist.addfile(setup_py_file, fileobj=setup_py_bytes)
 finally:
  dist.close()

def make_trivial_sdist ( dist_path , setup_py ) : setup_py_file = tarfile . TarInfo ( name = 'setup.py' ) try : MemFile = BytesIO except AttributeError : MemFile = StringIO setup_py_bytes = MemFile ( setup_py . encode ( 'utf-8' ) ) setup_py_file . size = len ( setup_py_bytes . getvalue ( ) ) dist = tarfile . open ( dist_path , 'w:gz' ) try : dist . addfile ( setup_py_file , fileobj = setup_py_bytes ) finally : dist . close ( )
create a simple sdist tarball at dist_path .