<s> from __future__ import absolute_import , print_function <EOL> import os <EOL> import tempfile <EOL> import textwrap <EOL> import subprocess <EOL> from setuptools import setup <EOL> version_info = { <EOL> '<STR_LIT:name>' : '<STR_LIT>' , <EOL> '<STR_LIT:version>' : '<STR_LIT>' , <EOL> '<STR_LIT:description>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT:url>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : [ <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' <EOL> ] <EOL> } <EOL> topdir , _ = os . path . split ( os . path . abspath ( __file__ ) ) <EOL> def update_version ( ) : <EOL> """<STR_LIT>""" <EOL> fname = os . path . join ( '<STR_LIT:.>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) <EOL> try : <EOL> with open ( fname ) as fin : <EOL> current = fin . read ( ) <EOL> except IOError : <EOL> current = None <EOL> new = textwrap . dedent ( """<STR_LIT>""" . format ( version_info ) ) <EOL> if current == new : <EOL> return <EOL> tmpname = '<STR_LIT>' . format ( fname , os . getpid ( ) ) <EOL> with open ( tmpname , '<STR_LIT:w>' ) as fout : <EOL> fout . write ( new ) <EOL> os . rename ( tmpname , fname ) <EOL> print ( '<STR_LIT>' ) <EOL> def update_manifest ( ) : <EOL> """<STR_LIT>""" <EOL> gitdir = os . path . join ( '<STR_LIT:.>' , '<STR_LIT>' ) <EOL> try : <EOL> st = os . stat ( gitdir ) <EOL> except OSError : <EOL> return <EOL> cmd = subprocess . Popen ( [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] , <EOL> stdout = subprocess . PIPE ) <EOL> stdout , _ = cmd . communicate ( ) <EOL> files = stdout . splitlines ( ) <EOL> files . append ( '<STR_LIT>' ) <EOL> lines = [ '<STR_LIT>' . format ( fname ) for fname in files ] <EOL> new = '<STR_LIT>' . join ( sorted ( lines ) ) <EOL> try : <EOL> with open ( '<STR_LIT>' , '<STR_LIT:r>' ) as fin : <EOL> current = fin . read ( ) <EOL> except IOError : <EOL> current = None <EOL> if new == current : <EOL> return <EOL> tmpname = '<STR_LIT>' . format ( os . getpid ( ) ) <EOL> with open ( tmpname , '<STR_LIT:w>' ) as fout : <EOL> fout . write ( new ) <EOL> os . rename ( tmpname , '<STR_LIT>' ) <EOL> print ( '<STR_LIT>' ) <EOL> sourcestxt = os . path . join ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) <EOL> if not os . access ( sourcestxt , os . R_OK ) : <EOL> return <EOL> os . unlink ( sourcestxt ) <EOL> print ( '<STR_LIT>' . format ( sourcestxt ) ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> os . chdir ( topdir ) <EOL> update_version ( ) <EOL> update_manifest ( ) <EOL> setup ( <EOL> package_dir = { '<STR_LIT>' : '<STR_LIT>' } , <EOL> packages = [ '<STR_LIT>' ] , <EOL> install_requires = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] , <EOL> entry_points = { '<STR_LIT>' : [ '<STR_LIT>' ] } , <EOL> package_data = { '<STR_LIT>' : [ '<STR_LIT>' , '<STR_LIT>' ] } , <EOL> ** version_info <EOL> ) </s>
