<s> import os <EOL> import tempfile <EOL> from django_seo_js import VERSION <EOL> from fabric . api import * <EOL> SITE_DIR = "<STR_LIT>" <EOL> WHITELIST_DIRS = [ "<STR_LIT>" , ] <EOL> WHITELIST_FILES = [ "<STR_LIT>" , ] <EOL> SANITY_CHECK_PROJECT_FILES = [ "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ] <EOL> SANITY_CHECK_BUILD_FILES = [ "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ] <EOL> def _splitpath ( path ) : <EOL> path = os . path . normpath ( path ) <EOL> return path . split ( os . sep ) <EOL> def tag_release ( ) : <EOL> local ( "<STR_LIT>" % VERSION ) <EOL> local ( "<STR_LIT>" ) <EOL> def upload_release ( ) : <EOL> local ( "<STR_LIT>" ) <EOL> def release ( ) : <EOL> upload_release ( ) <EOL> tag_release ( ) <EOL> def deploy_docs ( ) : <EOL> root_dir = os . getcwd ( ) <EOL> assert all ( [ os . path . exists ( os . path . join ( root_dir , f ) ) for f in SANITY_CHECK_PROJECT_FILES ] ) <EOL> local ( "<STR_LIT>" % SITE_DIR ) <EOL> local ( "<STR_LIT>" ) <EOL> tempdir = tempfile . mkdtemp ( ) <EOL> local ( "<STR_LIT>" % ( SITE_DIR , tempdir ) ) <EOL> current_branch = local ( "<STR_LIT>" , capture = True ) <EOL> last_commit = local ( "<STR_LIT>" , capture = True ) <EOL> local ( "<STR_LIT>" ) <EOL> root_dir = os . getcwd ( ) <EOL> assert all ( [ os . path . exists ( os . path . join ( root_dir , f ) ) for f in SANITY_CHECK_BUILD_FILES ] ) <EOL> for root , dirs , files in os . walk ( root_dir , topdown = False ) : <EOL> for name in files : <EOL> if name not in WHITELIST_FILES and not any ( [ r in WHITELIST_DIRS for r in _splitpath ( root ) ] ) : <EOL> os . remove ( os . path . join ( root , name ) ) <EOL> for name in dirs : <EOL> if name not in WHITELIST_DIRS and not any ( [ r in WHITELIST_DIRS for r in _splitpath ( root ) ] ) : <EOL> os . rmdir ( os . path . join ( root , name ) ) <EOL> local ( "<STR_LIT>" % tempdir ) <EOL> with settings ( warn_only = True ) : <EOL> result = local ( "<STR_LIT>" ) <EOL> if result . return_code != <NUM_LIT:0> : <EOL> local ( "<STR_LIT>" ) <EOL> local ( "<STR_LIT>" % last_commit ) <EOL> local ( "<STR_LIT>" ) <EOL> else : <EOL> print "<STR_LIT>" <EOL> local ( "<STR_LIT>" % current_branch ) </s>
