<s> '''<STR_LIT>''' <EOL> from __future__ import absolute_import <EOL> from __future__ import print_function , with_statement <EOL> import os <EOL> import sys <EOL> import glob <EOL> import time <EOL> try : <EOL> from urllib2 import urlopen <EOL> except ImportError : <EOL> from urllib . request import urlopen <EOL> from datetime import datetime <EOL> import distutils . dist <EOL> from distutils import log <EOL> from distutils . cmd import Command <EOL> from distutils . errors import DistutilsArgError <EOL> from distutils . command . build import build <EOL> from distutils . command . clean import clean <EOL> from distutils . command . sdist import sdist <EOL> from distutils . command . install_lib import install_lib <EOL> try : <EOL> import zmq <EOL> HAS_ZMQ = True <EOL> except ImportError : <EOL> HAS_ZMQ = False <EOL> try : <EOL> DATE = datetime . utcfromtimestamp ( int ( os . environ [ '<STR_LIT>' ] ) ) <EOL> except ( KeyError , ValueError ) : <EOL> DATE = datetime . utcnow ( ) <EOL> try : <EOL> SETUP_DIRNAME = os . path . dirname ( __file__ ) <EOL> except NameError : <EOL> SETUP_DIRNAME = os . path . dirname ( sys . argv [ <NUM_LIT:0> ] ) <EOL> if SETUP_DIRNAME != '<STR_LIT>' : <EOL> os . chdir ( SETUP_DIRNAME ) <EOL> SETUP_DIRNAME = os . path . abspath ( SETUP_DIRNAME ) <EOL> BOOTSTRAP_SCRIPT_DISTRIBUTED_VERSION = os . environ . get ( <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' <EOL> ) <EOL> IS_WINDOWS_PLATFORM = sys . platform . startswith ( '<STR_LIT>' ) <EOL> if IS_WINDOWS_PLATFORM : <EOL> IS_SMARTOS_PLATFORM = False <EOL> else : <EOL> IS_SMARTOS_PLATFORM = os . uname ( ) [ <NUM_LIT:0> ] == '<STR_LIT>' and os . uname ( ) [ <NUM_LIT:3> ] . startswith ( '<STR_LIT>' ) <EOL> IS_PY3 = sys . version_info > ( <NUM_LIT:3> , ) <EOL> WITH_SETUPTOOLS = False <EOL> if '<STR_LIT>' in os . environ or '<STR_LIT>' in sys . modules : <EOL> try : <EOL> from setuptools import setup <EOL> from setuptools . command . develop import develop <EOL> from setuptools . command . install import install <EOL> from setuptools . command . sdist import sdist <EOL> from setuptools . command . egg_info import egg_info <EOL> WITH_SETUPTOOLS = True <EOL> except ImportError : <EOL> WITH_SETUPTOOLS = False <EOL> if WITH_SETUPTOOLS is False : <EOL> import warnings <EOL> from distutils . command . install import install <EOL> from distutils . core import setup <EOL> warnings . filterwarnings ( <EOL> '<STR_LIT:ignore>' , <EOL> '<STR_LIT>' , <EOL> UserWarning , <EOL> '<STR_LIT>' <EOL> ) <EOL> try : <EOL> from esky import bdist_esky <EOL> import bbfreeze <EOL> HAS_ESKY = True <EOL> except ImportError : <EOL> HAS_ESKY = False <EOL> SALT_VERSION = os . path . join ( os . path . abspath ( SETUP_DIRNAME ) , '<STR_LIT>' , '<STR_LIT>' ) <EOL> SALT_VERSION_HARDCODED = os . path . join ( os . path . abspath ( SETUP_DIRNAME ) , '<STR_LIT>' , '<STR_LIT>' ) <EOL> SALT_SYSPATHS_HARDCODED = os . path . join ( os . path . abspath ( SETUP_DIRNAME ) , '<STR_LIT>' , '<STR_LIT>' ) <EOL> SALT_REQS = os . path . join ( os . path . abspath ( SETUP_DIRNAME ) , '<STR_LIT>' , '<STR_LIT>' ) <EOL> SALT_ZEROMQ_REQS = os . path . join ( os . path . abspath ( SETUP_DIRNAME ) , '<STR_LIT>' , '<STR_LIT>' ) <EOL> SALT_RAET_REQS = os . path . join ( os . path . abspath ( SETUP_DIRNAME ) , '<STR_LIT>' , '<STR_LIT>' ) <EOL> PACKAGED_FOR_SALT_SSH_FILE = os . path . join ( os . path . abspath ( SETUP_DIRNAME ) , '<STR_LIT>' ) <EOL> PACKAGED_FOR_SALT_SSH = os . path . isfile ( PACKAGED_FOR_SALT_SSH_FILE ) <EOL> exec ( compile ( open ( SALT_VERSION ) . read ( ) , SALT_VERSION , '<STR_LIT>' ) ) <EOL> def _parse_requirements_file ( requirements_file ) : <EOL> parsed_requirements = [ ] <EOL> with open ( requirements_file ) as rfh : <EOL> for line in rfh . readlines ( ) : <EOL> line = line . strip ( ) <EOL> if not line or line . startswith ( ( '<STR_LIT:#>' , '<STR_LIT>' ) ) : <EOL> continue <EOL> if IS_WINDOWS_PLATFORM : <EOL> if '<STR_LIT>' in line : <EOL> continue <EOL> if '<STR_LIT>' in line . lower ( ) : <EOL> continue <EOL> if '<STR_LIT>' in line . lower ( ) and __saltstack_version__ . info < ( <NUM_LIT> , <NUM_LIT:8> ) : <EOL> continue <EOL> if IS_PY3 and '<STR_LIT>' in line . lower ( ) : <EOL> continue <EOL> parsed_requirements . append ( line ) <EOL> return parsed_requirements <EOL> class WriteSaltVersion ( Command ) : <EOL> description = '<STR_LIT>' <EOL> user_options = [ ] <EOL> def initialize_options ( self ) : <EOL> '''<STR_LIT>''' <EOL> def finalize_options ( self ) : <EOL> '''<STR_LIT>''' <EOL> def run ( self ) : <EOL> if not os . path . exists ( SALT_VERSION_HARDCODED ) : <EOL> if getattr ( self . distribution , '<STR_LIT>' , None ) is None : <EOL> print ( '<STR_LIT>' ) <EOL> exit ( <NUM_LIT:1> ) <EOL> open ( self . distribution . salt_version_hardcoded_path , '<STR_LIT:w>' ) . write ( <EOL> INSTALL_VERSION_TEMPLATE . format ( <EOL> date = DATE , <EOL> full_version_info = __saltstack_version__ . full_info <EOL> ) <EOL> ) <EOL> class GenerateSaltSyspaths ( Command ) : <EOL> description = '<STR_LIT>' <EOL> def initialize_options ( self ) : <EOL> pass <EOL> def finalize_options ( self ) : <EOL> pass <EOL> def run ( self ) : <EOL> if getattr ( self . distribution , '<STR_LIT>' , None ) is None : <EOL> print ( '<STR_LIT>' ) <EOL> exit ( <NUM_LIT:1> ) <EOL> open ( self . distribution . salt_syspaths_hardcoded_path , '<STR_LIT:w>' ) . write ( <EOL> INSTALL_SYSPATHS_TEMPLATE . format ( <EOL> date = DATE , <EOL> root_dir = self . distribution . salt_root_dir , <EOL> config_dir = self . distribution . salt_config_dir , <EOL> cache_dir = self . distribution . salt_cache_dir , <EOL> sock_dir = self . distribution . salt_sock_dir , <EOL> srv_root_dir = self . distribution . salt_srv_root_dir , <EOL> base_file_roots_dir = self . distribution . salt_base_file_roots_dir , <EOL> base_pillar_roots_dir = self . distribution . salt_base_pillar_roots_dir , <EOL> base_master_roots_dir = self . distribution . salt_base_master_roots_dir , <EOL> base_thorium_roots_dir = self . distribution . salt_base_thorium_roots_dir , <EOL> logs_dir = self . distribution . salt_logs_dir , <EOL> pidfile_dir = self . distribution . salt_pidfile_dir , <EOL> spm_formula_path = self . distribution . salt_spm_formula_dir , <EOL> spm_pillar_path = self . distribution . salt_spm_pillar_dir , <EOL> spm_reactor_path = self . distribution . salt_spm_reactor_dir , <EOL> ) <EOL> ) <EOL> class WriteSaltSshPackagingFile ( Command ) : <EOL> description = '<STR_LIT>' <EOL> user_options = [ ] <EOL> def initialize_options ( self ) : <EOL> '''<STR_LIT>''' <EOL> def finalize_options ( self ) : <EOL> '''<STR_LIT>''' <EOL> def run ( self ) : <EOL> if not os . path . exists ( PACKAGED_FOR_SALT_SSH_FILE ) : <EOL> if getattr ( self . distribution , '<STR_LIT>' , None ) is None : <EOL> print ( '<STR_LIT>' ) <EOL> exit ( <NUM_LIT:1> ) <EOL> open ( self . distribution . salt_ssh_packaging_file , '<STR_LIT:w>' ) . write ( '<STR_LIT>' ) <EOL> if WITH_SETUPTOOLS : <EOL> class Develop ( develop ) : <EOL> user_options = develop . user_options + [ <EOL> ( '<STR_LIT>' , None , <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , None , <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , None , <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' ) <EOL> ] <EOL> boolean_options = develop . boolean_options + [ <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' <EOL> ] <EOL> def initialize_options ( self ) : <EOL> develop . initialize_options ( self ) <EOL> self . write_salt_version = False <EOL> self . generate_salt_syspaths = False <EOL> self . mimic_salt_install = False <EOL> def finalize_options ( self ) : <EOL> develop . finalize_options ( self ) <EOL> if '<STR_LIT>' in os . environ : <EOL> self . write_salt_version = True <EOL> if '<STR_LIT>' in os . environ : <EOL> self . generate_salt_syspaths = True <EOL> if '<STR_LIT>' in os . environ : <EOL> self . mimic_salt_install = True <EOL> if self . mimic_salt_install : <EOL> self . write_salt_version = True <EOL> self . generate_salt_syspaths = True <EOL> def run ( self ) : <EOL> if IS_WINDOWS_PLATFORM : <EOL> if __saltstack_version__ . info < ( <NUM_LIT> , <NUM_LIT:8> ) : <EOL> self . distribution . salt_installing_m2crypto_windows = True <EOL> self . run_command ( '<STR_LIT>' ) <EOL> self . distribution . salt_installing_m2crypto_windows = None <EOL> self . distribution . salt_installing_pycrypto_windows = True <EOL> self . run_command ( '<STR_LIT>' ) <EOL> self . distribution . salt_installing_pycrypto_windows = None <EOL> self . distribution . salt_download_windows_dlls = True <EOL> self . run_command ( '<STR_LIT>' ) <EOL> self . distribution . salt_download_windows_dlls = None <EOL> if self . write_salt_version is True : <EOL> self . distribution . running_salt_install = True <EOL> self . distribution . salt_version_hardcoded_path = SALT_VERSION_HARDCODED <EOL> self . run_command ( '<STR_LIT>' ) <EOL> if self . generate_salt_syspaths : <EOL> self . distribution . salt_syspaths_hardcoded_path = SALT_SYSPATHS_HARDCODED <EOL> self . run_command ( '<STR_LIT>' ) <EOL> develop . run ( self ) <EOL> class InstallM2CryptoWindows ( Command ) : <EOL> description = '<STR_LIT>' <EOL> def initialize_options ( self ) : <EOL> pass <EOL> def finalize_options ( self ) : <EOL> pass <EOL> def run ( self ) : <EOL> if getattr ( self . distribution , '<STR_LIT>' , None ) is None : <EOL> print ( '<STR_LIT>' ) <EOL> exit ( <NUM_LIT:1> ) <EOL> import platform <EOL> from pip . utils import call_subprocess <EOL> from pip . utils . logging import indent_log <EOL> platform_bits , _ = platform . architecture ( ) <EOL> with indent_log ( ) : <EOL> call_subprocess ( <EOL> [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' . format ( platform_bits [ : <NUM_LIT:2> ] ) ] <EOL> ) <EOL> class InstallPyCryptoWindowsWheel ( Command ) : <EOL> description = '<STR_LIT>' <EOL> def initialize_options ( self ) : <EOL> pass <EOL> def finalize_options ( self ) : <EOL> pass <EOL> def run ( self ) : <EOL> if getattr ( self . distribution , '<STR_LIT>' , None ) is None : <EOL> print ( '<STR_LIT>' ) <EOL> exit ( <NUM_LIT:1> ) <EOL> import platform <EOL> from pip . utils import call_subprocess <EOL> from pip . utils . logging import indent_log <EOL> platform_bits , _ = platform . architecture ( ) <EOL> call_arguments = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] <EOL> if platform_bits == '<STR_LIT>' : <EOL> call_arguments . append ( <EOL> '<STR_LIT>' <EOL> ) <EOL> else : <EOL> call_arguments . append ( <EOL> '<STR_LIT>' <EOL> ) <EOL> with indent_log ( ) : <EOL> call_subprocess ( call_arguments ) <EOL> class DownloadWindowsDlls ( Command ) : <EOL> description = '<STR_LIT>' <EOL> def initialize_options ( self ) : <EOL> pass <EOL> def finalize_options ( self ) : <EOL> pass <EOL> def run ( self ) : <EOL> if getattr ( self . distribution , '<STR_LIT>' , None ) is None : <EOL> print ( '<STR_LIT>' ) <EOL> exit ( <NUM_LIT:1> ) <EOL> import platform <EOL> from pip . utils . logging import indent_log <EOL> platform_bits , _ = platform . architecture ( ) <EOL> url = '<STR_LIT>' <EOL> dest = os . path . join ( os . path . dirname ( sys . executable ) , '<STR_LIT>' ) <EOL> with indent_log ( ) : <EOL> for fname in ( '<STR_LIT>' , '<STR_LIT>' ) : <EOL> furl = url . format ( bits = platform_bits [ : <NUM_LIT:2> ] , fname = fname ) <EOL> fdest = dest . format ( fname = fname ) <EOL> if not os . path . exists ( fdest ) : <EOL> log . info ( '<STR_LIT>' . format ( fname , fdest , furl ) ) <EOL> try : <EOL> import requests <EOL> from contextlib import closing <EOL> with closing ( requests . get ( furl , stream = True ) ) as req : <EOL> if req . status_code == <NUM_LIT:200> : <EOL> with open ( fdest , '<STR_LIT:wb>' ) as wfh : <EOL> for chunk in req . iter_content ( chunk_size = <NUM_LIT> ) : <EOL> if chunk : <EOL> wfh . write ( chunk ) <EOL> wfh . flush ( ) <EOL> else : <EOL> log . error ( <EOL> '<STR_LIT>' . format ( <EOL> fname , fdest , furl <EOL> ) <EOL> ) <EOL> except ImportError : <EOL> req = urlopen ( furl ) <EOL> if req . getcode ( ) == <NUM_LIT:200> : <EOL> with open ( fdest , '<STR_LIT:wb>' ) as wfh : <EOL> if IS_PY3 : <EOL> while True : <EOL> chunk = req . read ( <NUM_LIT> ) <EOL> if len ( chunk ) == <NUM_LIT:0> : <EOL> break ; <EOL> wfh . write ( chunk ) <EOL> wfh . flush ( ) <EOL> else : <EOL> while True : <EOL> for chunk in req . read ( <NUM_LIT> ) : <EOL> if not chunk : <EOL> break <EOL> wfh . write ( chunk ) <EOL> wfh . flush ( ) <EOL> else : <EOL> log . error ( <EOL> '<STR_LIT>' . format ( <EOL> fname , fdest , furl <EOL> ) <EOL> ) <EOL> class Sdist ( sdist ) : <EOL> def make_release_tree ( self , base_dir , files ) : <EOL> if self . distribution . ssh_packaging : <EOL> self . distribution . salt_ssh_packaging_file = PACKAGED_FOR_SALT_SSH_FILE <EOL> self . run_command ( '<STR_LIT>' ) <EOL> self . filelist . files . append ( os . path . basename ( PACKAGED_FOR_SALT_SSH_FILE ) ) <EOL> sdist . make_release_tree ( self , base_dir , files ) <EOL> self . distribution . running_salt_sdist = True <EOL> self . distribution . salt_version_hardcoded_path = os . path . join ( <EOL> base_dir , '<STR_LIT>' , '<STR_LIT>' <EOL> ) <EOL> self . run_command ( '<STR_LIT>' ) <EOL> def make_distribution ( self ) : <EOL> sdist . make_distribution ( self ) <EOL> if self . distribution . ssh_packaging : <EOL> os . unlink ( PACKAGED_FOR_SALT_SSH_FILE ) <EOL> class CloudSdist ( Sdist ) : <EOL> user_options = Sdist . user_options + [ <EOL> ( '<STR_LIT>' , None , <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' ) <EOL> ] <EOL> boolean_options = Sdist . boolean_options + [ <EOL> '<STR_LIT>' <EOL> ] <EOL> def initialize_options ( self ) : <EOL> Sdist . initialize_options ( self ) <EOL> self . skip_bootstrap_download = True <EOL> self . download_bootstrap_script = False <EOL> def finalize_options ( self ) : <EOL> Sdist . finalize_options ( self ) <EOL> if '<STR_LIT>' in os . environ : <EOL> log ( '<STR_LIT>' <EOL> '<STR_LIT>' ) <EOL> if '<STR_LIT>' in os . environ : <EOL> download_bootstrap_script = os . environ . get ( <EOL> '<STR_LIT>' , '<STR_LIT:0>' <EOL> ) <EOL> self . download_bootstrap_script = download_bootstrap_script == '<STR_LIT:1>' <EOL> def run ( self ) : <EOL> if self . download_bootstrap_script is True : <EOL> url = ( <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' . format ( <EOL> BOOTSTRAP_SCRIPT_DISTRIBUTED_VERSION <EOL> ) <EOL> ) <EOL> deploy_path = os . path . join ( <EOL> SETUP_DIRNAME , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' <EOL> ) <EOL> log . info ( <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' . format ( <EOL> url , <EOL> deploy_path <EOL> ) <EOL> ) <EOL> try : <EOL> import requests <EOL> req = requests . get ( url ) <EOL> if req . status_code == <NUM_LIT:200> : <EOL> script_contents = req . text . encode ( req . encoding ) <EOL> else : <EOL> log . error ( <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' . format ( <EOL> req . status_code <EOL> ) <EOL> ) <EOL> except ImportError : <EOL> req = urlopen ( url ) <EOL> if req . getcode ( ) == <NUM_LIT:200> : <EOL> script_contents = req . read ( ) <EOL> else : <EOL> log . error ( <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' . format ( <EOL> req . getcode ( ) <EOL> ) <EOL> ) <EOL> try : <EOL> with open ( deploy_path , '<STR_LIT:w>' ) as fp_ : <EOL> fp_ . write ( script_contents ) <EOL> except ( OSError , IOError ) as err : <EOL> log . error ( <EOL> '<STR_LIT>' . format ( err ) <EOL> ) <EOL> Sdist . run ( self ) <EOL> def write_manifest ( self ) : <EOL> dist_scripts = self . distribution . scripts <EOL> for script in self . filelist . files [ : ] : <EOL> if not script . startswith ( '<STR_LIT>' ) : <EOL> continue <EOL> if script not in dist_scripts : <EOL> self . filelist . files . remove ( script ) <EOL> return Sdist . write_manifest ( self ) <EOL> class TestCommand ( Command ) : <EOL> description = '<STR_LIT>' <EOL> user_options = [ <EOL> ( '<STR_LIT>' , '<STR_LIT:R>' , '<STR_LIT>' ) <EOL> ] <EOL> def initialize_options ( self ) : <EOL> self . runtests_opts = None <EOL> def finalize_options ( self ) : <EOL> '''<STR_LIT>''' <EOL> def run ( self ) : <EOL> from subprocess import Popen <EOL> self . run_command ( '<STR_LIT>' ) <EOL> build_cmd = self . get_finalized_command ( '<STR_LIT>' ) <EOL> runner = os . path . abspath ( '<STR_LIT>' ) <EOL> test_cmd = sys . executable + '<STR_LIT>' . format ( runner ) <EOL> if self . runtests_opts : <EOL> test_cmd += '<STR_LIT>' . format ( self . runtests_opts ) <EOL> print ( '<STR_LIT>' ) <EOL> test_process = Popen ( <EOL> test_cmd , shell = True , <EOL> stdout = sys . stdout , stderr = sys . stderr , <EOL> cwd = build_cmd . build_lib <EOL> ) <EOL> test_process . communicate ( ) <EOL> sys . exit ( test_process . returncode ) <EOL> class Clean ( clean ) : <EOL> def run ( self ) : <EOL> clean . run ( self ) <EOL> for subdir in ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) : <EOL> root = os . path . join ( os . path . dirname ( __file__ ) , subdir ) <EOL> for dirname , _ , _ in os . walk ( root ) : <EOL> for to_remove_filename in glob . glob ( '<STR_LIT>' . format ( dirname ) ) : <EOL> os . remove ( to_remove_filename ) <EOL> INSTALL_VERSION_TEMPLATE = '''<STR_LIT>''' <EOL> INSTALL_SYSPATHS_TEMPLATE = '''<STR_LIT>''' <EOL> class Build ( build ) : <EOL> def run ( self ) : <EOL> build . run ( self ) <EOL> if getattr ( self . distribution , '<STR_LIT>' , False ) : <EOL> self . run_command ( '<STR_LIT>' ) <EOL> self . distribution . salt_syspaths_hardcoded_path = os . path . join ( <EOL> self . build_lib , '<STR_LIT>' , '<STR_LIT>' <EOL> ) <EOL> self . run_command ( '<STR_LIT>' ) <EOL> class Install ( install ) : <EOL> user_options = install . user_options + [ <EOL> ( '<STR_LIT>' , None , '<STR_LIT>' <EOL> '<STR_LIT>' , '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , None , <EOL> '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , None , <EOL> '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , None , <EOL> '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , None , <EOL> '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , None , <EOL> '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , None , <EOL> '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , None , <EOL> '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , None , <EOL> '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , None , <EOL> '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , None , <EOL> '<STR_LIT>' ) , <EOL> ] <EOL> def initialize_options ( self ) : <EOL> install . initialize_options ( self ) <EOL> def finalize_options ( self ) : <EOL> install . finalize_options ( self ) <EOL> def run ( self ) : <EOL> self . distribution . running_salt_install = True <EOL> self . distribution . salt_version_hardcoded_path = os . path . join ( <EOL> self . build_lib , '<STR_LIT>' , '<STR_LIT>' <EOL> ) <EOL> if IS_WINDOWS_PLATFORM : <EOL> if __saltstack_version__ . info < ( <NUM_LIT> , <NUM_LIT:8> ) : <EOL> self . distribution . salt_installing_m2crypto_windows = True <EOL> self . run_command ( '<STR_LIT>' ) <EOL> self . distribution . salt_installing_m2crypto_windows = None <EOL> self . distribution . salt_installing_pycrypto_windows = True <EOL> self . run_command ( '<STR_LIT>' ) <EOL> self . distribution . salt_installing_pycrypto_windows = None <EOL> self . distribution . salt_download_windows_dlls = True <EOL> self . run_command ( '<STR_LIT>' ) <EOL> self . distribution . salt_download_windows_dlls = None <EOL> install . run ( self ) <EOL> class InstallLib ( install_lib ) : <EOL> def run ( self ) : <EOL> executables = [ <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> ] <EOL> install_lib . run ( self ) <EOL> inp = self . get_inputs ( ) <EOL> out = self . get_outputs ( ) <EOL> chmod = [ ] <EOL> for idx , inputfile in enumerate ( inp ) : <EOL> for executeable in executables : <EOL> if inputfile . endswith ( executeable ) : <EOL> chmod . append ( idx ) <EOL> for idx in chmod : <EOL> filename = out [ idx ] <EOL> os . chmod ( filename , <NUM_LIT> ) <EOL> class SaltDistribution ( distutils . dist . Distribution ) : <EOL> '''<STR_LIT>''' <EOL> global_options = distutils . dist . Distribution . global_options + [ <EOL> ( '<STR_LIT>' , None , '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , None , '<STR_LIT>' <EOL> '<STR_LIT>' , '<STR_LIT>' ) ] + [ <EOL> ( '<STR_LIT>' , None , <EOL> '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , None , <EOL> '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , None , <EOL> '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , None , <EOL> '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , None , <EOL> '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , None , <EOL> '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , None , <EOL> '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , None , <EOL> '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , None , <EOL> '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , None , <EOL> '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , None , <EOL> '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , None , <EOL> '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , None , <EOL> '<STR_LIT>' ) , <EOL> ] <EOL> def __init__ ( self , attrs = None ) : <EOL> distutils . dist . Distribution . __init__ ( self , attrs ) <EOL> self . ssh_packaging = PACKAGED_FOR_SALT_SSH <EOL> self . salt_transport = None <EOL> self . salt_root_dir = None <EOL> self . salt_config_dir = None <EOL> self . salt_cache_dir = None <EOL> self . salt_sock_dir = None <EOL> self . salt_srv_root_dir = None <EOL> self . salt_base_file_roots_dir = None <EOL> self . salt_base_thorium_roots_dir = None <EOL> self . salt_base_pillar_roots_dir = None <EOL> self . salt_base_master_roots_dir = None <EOL> self . salt_logs_dir = None <EOL> self . salt_pidfile_dir = None <EOL> self . salt_spm_formula_dir = None <EOL> self . salt_spm_pillar_dir = None <EOL> self . salt_spm_reactor_dir = None <EOL> self . name = '<STR_LIT>' if PACKAGED_FOR_SALT_SSH else '<STR_LIT>' <EOL> self . salt_version = __version__ <EOL> self . description = '<STR_LIT>' <EOL> self . author = '<STR_LIT>' <EOL> self . author_email = '<STR_LIT>' <EOL> self . url = '<STR_LIT>' <EOL> self . cmdclass . update ( { '<STR_LIT:test>' : TestCommand , <EOL> '<STR_LIT>' : Clean , <EOL> '<STR_LIT>' : Build , <EOL> '<STR_LIT>' : Sdist , <EOL> '<STR_LIT>' : Install , <EOL> '<STR_LIT>' : WriteSaltVersion , <EOL> '<STR_LIT>' : GenerateSaltSyspaths , <EOL> '<STR_LIT>' : WriteSaltSshPackagingFile } ) <EOL> if not IS_WINDOWS_PLATFORM : <EOL> self . cmdclass . update ( { '<STR_LIT>' : CloudSdist , <EOL> '<STR_LIT>' : InstallLib } ) <EOL> if IS_WINDOWS_PLATFORM : <EOL> self . cmdclass . update ( { '<STR_LIT>' : InstallPyCryptoWindowsWheel , <EOL> '<STR_LIT>' : DownloadWindowsDlls } ) <EOL> if __saltstack_version__ . info < ( <NUM_LIT> , <NUM_LIT:8> ) : <EOL> self . cmdclass . update ( { '<STR_LIT>' : InstallM2CryptoWindows } ) <EOL> if WITH_SETUPTOOLS : <EOL> self . cmdclass . update ( { '<STR_LIT>' : Develop } ) <EOL> self . license = '<STR_LIT>' <EOL> self . packages = self . discover_packages ( ) <EOL> self . zip_safe = False <EOL> if HAS_ESKY : <EOL> self . setup_esky ( ) <EOL> self . update_metadata ( ) <EOL> def update_metadata ( self ) : <EOL> for attrname in dir ( self ) : <EOL> if attrname . startswith ( '<STR_LIT>' ) : <EOL> continue <EOL> attrvalue = getattr ( self , attrname , None ) <EOL> if attrvalue == <NUM_LIT:0> : <EOL> continue <EOL> if attrname == '<STR_LIT>' : <EOL> attrname = '<STR_LIT:version>' <EOL> if hasattr ( self . metadata , '<STR_LIT>' . format ( attrname ) ) : <EOL> getattr ( self . metadata , '<STR_LIT>' . format ( attrname ) ) ( attrvalue ) <EOL> elif hasattr ( self . metadata , attrname ) : <EOL> try : <EOL> setattr ( self . metadata , attrname , attrvalue ) <EOL> except AttributeError : <EOL> pass <EOL> def discover_packages ( self ) : <EOL> modules = [ ] <EOL> for root , _ , files in os . walk ( os . path . join ( SETUP_DIRNAME , '<STR_LIT>' ) ) : <EOL> if '<STR_LIT>' not in files : <EOL> continue <EOL> modules . append ( os . path . relpath ( root , SETUP_DIRNAME ) . replace ( os . sep , '<STR_LIT:.>' ) ) <EOL> return modules <EOL> @ property <EOL> def _property_classifiers ( self ) : <EOL> return [ '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' ] <EOL> @ property <EOL> def _property_dependency_links ( self ) : <EOL> return [ '<STR_LIT>' ] <EOL> @ property <EOL> def _property_tests_require ( self ) : <EOL> return [ '<STR_LIT>' ] <EOL> @ property <EOL> def _property_package_data ( self ) : <EOL> package_data = { '<STR_LIT>' : [ '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> ] } <EOL> if not IS_WINDOWS_PLATFORM : <EOL> package_data [ '<STR_LIT>' ] = [ '<STR_LIT>' ] <EOL> if not self . ssh_packaging and not PACKAGED_FOR_SALT_SSH : <EOL> package_data [ '<STR_LIT>' ] = [ '<STR_LIT>' ] <EOL> return package_data <EOL> @ property <EOL> def _property_data_files ( self ) : <EOL> data_files = [ <EOL> ( '<STR_LIT>' , [ '<STR_LIT>' , '<STR_LIT>' ] ) , <EOL> ( '<STR_LIT>' , [ '<STR_LIT>' ] ) <EOL> ] <EOL> if self . ssh_packaging or PACKAGED_FOR_SALT_SSH : <EOL> data_files [ <NUM_LIT:0> ] [ <NUM_LIT:1> ] . append ( '<STR_LIT>' ) <EOL> if IS_WINDOWS_PLATFORM : <EOL> return data_files <EOL> data_files [ <NUM_LIT:0> ] [ <NUM_LIT:1> ] . append ( '<STR_LIT>' ) <EOL> return data_files <EOL> if IS_WINDOWS_PLATFORM : <EOL> data_files [ <NUM_LIT:0> ] [ <NUM_LIT:1> ] . extend ( [ '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' ] ) <EOL> return data_files <EOL> data_files [ <NUM_LIT:0> ] [ <NUM_LIT:1> ] . extend ( [ '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' ] ) <EOL> return data_files <EOL> @ property <EOL> def _property_install_requires ( self ) : <EOL> install_requires = _parse_requirements_file ( SALT_REQS ) <EOL> if IS_WINDOWS_PLATFORM : <EOL> install_requires . append ( '<STR_LIT>' ) <EOL> install_requires . append ( '<STR_LIT>' ) <EOL> if self . salt_transport == '<STR_LIT>' : <EOL> install_requires += _parse_requirements_file ( SALT_ZEROMQ_REQS ) <EOL> elif self . salt_transport == '<STR_LIT>' : <EOL> install_requires += _parse_requirements_file ( SALT_RAET_REQS ) <EOL> return install_requires <EOL> @ property <EOL> def _property_extras_require ( self ) : <EOL> if self . ssh_packaging : <EOL> return { } <EOL> return { '<STR_LIT>' : _parse_requirements_file ( SALT_RAET_REQS ) } <EOL> @ property <EOL> def _property_scripts ( self ) : <EOL> scripts = [ '<STR_LIT>' , '<STR_LIT>' ] <EOL> if self . ssh_packaging or PACKAGED_FOR_SALT_SSH : <EOL> scripts . append ( '<STR_LIT>' ) <EOL> if IS_WINDOWS_PLATFORM : <EOL> return scripts <EOL> scripts . extend ( [ '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> return scripts <EOL> if IS_WINDOWS_PLATFORM : <EOL> scripts . extend ( [ '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' ] ) <EOL> return scripts <EOL> scripts . extend ( [ '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' ] ) <EOL> return scripts <EOL> @ property <EOL> def _property_entry_points ( self ) : <EOL> scripts = [ '<STR_LIT>' , <EOL> '<STR_LIT>' ] <EOL> if self . ssh_packaging or PACKAGED_FOR_SALT_SSH : <EOL> scripts . append ( '<STR_LIT>' ) <EOL> if IS_WINDOWS_PLATFORM : <EOL> return { '<STR_LIT>' : scripts } <EOL> scripts . append ( '<STR_LIT>' ) <EOL> return { '<STR_LIT>' : scripts } <EOL> if IS_WINDOWS_PLATFORM : <EOL> scripts . extend ( [ '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' ] ) <EOL> return { '<STR_LIT>' : scripts } <EOL> scripts . extend ( [ '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' ] ) <EOL> return { '<STR_LIT>' : scripts } <EOL> def setup_esky ( self ) : <EOL> opt_dict = self . get_option_dict ( '<STR_LIT>' ) <EOL> opt_dict [ '<STR_LIT>' ] = ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> opt_dict [ '<STR_LIT>' ] = ( '<STR_LIT>' , { '<STR_LIT>' : self . get_esky_freezer_includes ( ) } ) <EOL> @ property <EOL> def _property_freezer_options ( self ) : <EOL> return { '<STR_LIT>' : self . get_esky_freezer_includes ( ) } <EOL> def get_esky_freezer_includes ( self ) : <EOL> freezer_includes = [ <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT:email>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> ] <EOL> if HAS_ZMQ and hasattr ( zmq , '<STR_LIT>' ) : <EOL> if HAS_ZMQ and zmq . pyzmq_version_info ( ) >= ( <NUM_LIT:0> , <NUM_LIT> ) : <EOL> if '<STR_LIT>' in freezer_includes : <EOL> freezer_includes . remove ( '<STR_LIT>' ) <EOL> if IS_WINDOWS_PLATFORM : <EOL> freezer_includes . extend ( [ <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<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> elif IS_SMARTOS_PLATFORM : <EOL> freezer_includes . extend ( [ <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> ] ) <EOL> elif sys . platform . startswith ( '<STR_LIT>' ) : <EOL> freezer_includes . append ( '<STR_LIT>' ) <EOL> try : <EOL> import yum <EOL> freezer_includes . append ( '<STR_LIT>' ) <EOL> except ImportError : <EOL> pass <EOL> elif sys . platform . startswith ( '<STR_LIT>' ) : <EOL> try : <EOL> from bbfreeze . modulegraph . modulegraph import ModuleGraph <EOL> mgraph = ModuleGraph ( sys . path [ : ] ) <EOL> for arg in glob . glob ( '<STR_LIT>' ) : <EOL> mgraph . run_script ( arg ) <EOL> for mod in mgraph . flatten ( ) : <EOL> if type ( mod ) . __name__ != '<STR_LIT>' and mod . filename : <EOL> freezer_includes . append ( str ( os . path . basename ( mod . identifier ) ) ) <EOL> except ImportError : <EOL> pass <EOL> freezer_includes . extend ( [ <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> ] ) <EOL> return freezer_includes <EOL> def parse_command_line ( self ) : <EOL> args = distutils . dist . Distribution . parse_command_line ( self ) <EOL> if not self . ssh_packaging and PACKAGED_FOR_SALT_SSH : <EOL> self . ssh_packaging = <NUM_LIT:1> <EOL> if self . ssh_packaging : <EOL> self . metadata . name = '<STR_LIT>' <EOL> self . salt_transport = '<STR_LIT>' <EOL> elif self . salt_transport is None : <EOL> self . salt_transport = '<STR_LIT>' <EOL> if self . salt_transport not in ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT:none>' ) : <EOL> raise DistutilsArgError ( <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' . format ( <EOL> self . salt_transport <EOL> ) <EOL> ) <EOL> for funcname in dir ( self ) : <EOL> if not funcname . startswith ( '<STR_LIT>' ) : <EOL> continue <EOL> property_name = funcname . split ( '<STR_LIT>' , <NUM_LIT:1> ) [ - <NUM_LIT:1> ] <EOL> setattr ( self , property_name , getattr ( self , funcname ) ) <EOL> return args <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> setup ( distclass = SaltDistribution ) </s>
