<s> from __future__ import absolute_import , print_function , unicode_literals <EOL> import io <EOL> import json <EOL> import os <EOL> import subprocess <EOL> from setuptools import Command <EOL> from setuptools . command . bdist_egg import bdist_egg <EOL> from setuptools . command . sdist import sdist as base_sdist <EOL> from wagtail . wagtailcore import __semver__ <EOL> class assets_mixin ( object ) : <EOL> def compile_assets ( self ) : <EOL> try : <EOL> subprocess . check_call ( [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> except ( OSError , subprocess . CalledProcessError ) as e : <EOL> print ( '<STR_LIT>' + str ( e ) ) <EOL> raise SystemExit ( <NUM_LIT:1> ) <EOL> def publish_assets ( self ) : <EOL> try : <EOL> subprocess . check_call ( [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> except ( OSError , subprocess . CalledProcessError ) as e : <EOL> print ( '<STR_LIT>' + str ( e ) ) <EOL> raise SystemExit ( <NUM_LIT:1> ) <EOL> def bump_client_version ( self ) : <EOL> """<STR_LIT>""" <EOL> path = os . path . join ( '<STR_LIT:.>' , '<STR_LIT>' , '<STR_LIT>' ) <EOL> input_file = io . open ( path , "<STR_LIT:r>" ) <EOL> try : <EOL> package = json . loads ( input_file . read ( ) . decode ( "<STR_LIT:utf-8>" ) ) <EOL> except ( ValueError ) as e : <EOL> print ( '<STR_LIT>' + path + '<STR_LIT:U+0020>' + e ) <EOL> raise SystemExit ( <NUM_LIT:1> ) <EOL> package [ '<STR_LIT:version>' ] = __semver__ <EOL> try : <EOL> with io . open ( path , '<STR_LIT:w>' , encoding = '<STR_LIT:utf-8>' ) as f : <EOL> from django . utils import six <EOL> f . write ( six . text_type ( json . dumps ( package , indent = <NUM_LIT:2> , ensure_ascii = False ) ) ) <EOL> except ( IOError ) as e : <EOL> print ( '<STR_LIT>' + str ( e ) ) <EOL> raise SystemExit ( <NUM_LIT:1> ) <EOL> class assets ( Command , assets_mixin ) : <EOL> user_options = [ ] <EOL> def initialize_options ( self ) : <EOL> pass <EOL> def finalize_options ( self ) : <EOL> pass <EOL> def run ( self ) : <EOL> self . bump_client_version ( ) <EOL> self . compile_assets ( ) <EOL> self . publish_assets ( ) <EOL> class sdist ( base_sdist , assets_mixin ) : <EOL> def run ( self ) : <EOL> self . compile_assets ( ) <EOL> base_sdist . run ( self ) <EOL> class check_bdist_egg ( bdist_egg ) : <EOL> sentinel_dir = '<STR_LIT>' <EOL> def run ( self ) : <EOL> bdist_egg . run ( self ) <EOL> if not os . path . isdir ( self . sentinel_dir ) : <EOL> print ( "<STR_LIT:\n>" . join ( [ <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> ] ) ) </s>
