from setuptools import setup import os completion_commands = [] with open('confluent.fish') as completion_file: completion_commands = [line.split()[2] for line in completion_file if line.startswith('complete -c ')] completion_dir = 'fish_completions' if not os.path.isdir(completion_dir): os.makedirs(completion_dir) for command in completion_commands: completion_path = os.path.join(completion_dir, command + '.fish') with open(completion_path, 'w') as completion_file: completion_file.write( 'source (path dirname (status filename))/confluent.fish\n') data_files = [('/etc/profile.d', ['confluent_env.sh', 'confluent_env.csh']), ('/usr/share/fish/vendor_completions.d/', ['confluent.fish'] + [os.path.join(completion_dir, command + '.fish') for command in completion_commands]), ('/opt/confluent/share/licenses/confluent_client/', ['LICENSE', 'COPYRIGHT']) ] try: scriptlist = ['bin/{0}'.format(d) for d in os.listdir('bin/')] data_files.append(('/opt/confluent/share/man/man1', ['man/man1/' + x for x in os.listdir('man/man1')])) data_files.append(('/opt/confluent/share/man/man5', ['man/man5/' + x for x in os.listdir('man/man5')])) data_files.append(('/opt/confluent/share/man/man8', ['man/man8/' + x for x in os.listdir('man/man8')])) except OSError: pass setup( name='confluent_client', version='#VERSION#', author='Lenovo', author_email='jjohnson2@lenovo.com', url='http://github.com/lenovo/confluent/', license='Apache-2.0', description='Command line client and libraries for confluent management server', long_description='Command line client and libraries for confluent management server', packages=['confluent'], platforms=['Linux'], scripts=scriptlist, data_files=data_files, )