Пример #1
0
 def directory(self, *directories):
     directories = flatten(directories)
     glob_list = [ ]
     for directory in directories:
         glob_list += glob('{0}/*'.format(directory))
     glob_list = fix_strings(list(set(glob_list)))
     for file_name in glob_list:
         self.file_list.append(file_name)
Пример #2
0
 def rmdir(self, *directories):
     directories = flatten(directories)
     glob_list = [ ]
     for directory in directories:
         glob_list += glob('{0}/*'.format(directory))
     glob_list = fix_strings(list(set(glob_list)))
     for file_name in glob_list:
         try:
             self.file_list.remove(file_name)
         except ValueError:
             raise Exception('Could not remove {0}'.format(file_name)) 
Пример #3
0
 def files(self, *files):
     files = flatten(files)
     glob_list = [ ]
     for file_name in files:
         if os.path.isdir(file_name):
             for root, directory, file_names in os.walk(file_name):
                 glob_list += glob('{0}/*'.format(root))
         else:
             glob_list.append(file_name)
     glob_list = fix_strings(list(set(glob_list)))
     for file_name in glob_list:
         self.file_list.append(file_name)
Пример #4
0
 def setup_files(self):
     self.file_list = flatten(list(set(self.file_list)))
     final_list = [ ]
     for file_name in self.file_list:
         out_file = '{0}/{1}'.format(self.build_directory, file_name)
         try:
             if not filecmp.cmp(file_name, out_file):
                 final_list.append(file_name)
         except OSError:
             pass
     self.file_list = proper_list
     self.file_count = len(self.file_list)
Пример #5
0
 def rmfiles(self, *files):
     files = flatten(files)
     glob_list = [ ]
     for file_name in files:
         if os.path.isdir(file_name):
             for root, directory, files_names in os.walk(file):
                 glob_list += glob('{0}/*'.format(root))
         else:
             glob_list.append(file_name)
     glob_list = fix_strings(list(set(glob_list)))
     for file_name in glob_list:
         try:
             self.file_list.remove(file_name)
         except ValueError:
             raise Exception('Could not remove {0}'.format(file_name)) 
Пример #6
0
Файл: mingw.py Проект: am0d/bit
 def resource(self, *files):
     for file_name in flatten(list(set(files))):
         directory = file_name.split('/')
         directory.pop()
         directory = '/'.join(directory)
         directory = '{0}/{1}'.format(self.object_directory, directory)
         try:
             os.makedirs(directory)
         except OSError:
             pass
         file_out = '{0}/{1}.{2}'.format(self.object_directory, file_name, self.output_extension)
         run_string = '{0} {1} -o {2}'.format(self.resource_compiler, file_name, file_out)
         try:
             return_value = subprocess.call(run_string)
         except OSError:
             return_value = os.system(run_string)
         if return_value:
             return
         self.compiler.link_list.append(file_out)
Пример #7
0
 def setup_files(self):
     self.database = Database(self.project_name, self.name)
     self.file_list = list(set(flatten(self.file_list)))
     proper_list = [ ]
     compile_list = [ ]
     for extension in self.extensions:
         for file_name in self.file_list:
             if file_name.endswith(extension):
                 proper_list.append(file_name)
     self.file_list = proper_list
     for file_name in self.file_list:
         file_hash = hash(file_name)
         out_file = '{0}/{1}.{2}'.format(self.object_directory, file_name, 
                                         self.output_extension)
         if os.path.exists(out_file) and file_hash == self.database.get_hash(file_name):
             self.link_list.append(out_file)
             continue
         compile_list.append(file_name)
         self.internal_hash_tracker[file_name] = file_hash
     self.file_list = list(set(compile_list))
     self.file_count = len(self.file_list)
     return 0
Пример #8
0
Файл: msvc.py Проект: am0d/bit
 def link_files(self):
     try:
         os.makedirs(self.build_directory)
     except OSError:
         pass
     if self.type == 'static':
         self.executable = 'lib'
         out_comm = '/OUT:{0}/{1}.lib'.format(self.build_directory, self.project_name)
     elif self.type == 'dynamic':
         self.lflags('/LD'), self.lflags('/DLL'), self.lflags('/link')
         out_comm = '/OUT:{0}/{1}.dll'.format(self.build_directory, self.project_name)
     else:
         self.lflags('/Fe"{0}/{1}.exe"'.format(self.build_directory, self.project_name))
         out_comm = [ ]
     run_list = flatten([self.executable, '/nologo'] + self.link_list + self.linker_flags + [out_comm])
     run_list = ' '.join(run_list)
     command('[LINK] {0}'.format(self.project_name))
     try:
         subprocess.call(run_list)
     except OSError:
         os.system(run_list)
     return 0
Пример #9
0
Файл: cc.py Проект: am0d/bit
 def link_files(self):
     if self.type == 'static':
         self.project_name = 'lib{0}.a'.format(self.project_name)
         self.lflags('-static')
     elif self.type == 'dynamic':
         self.project_name = 'lib{0}{1}'.format(self.project_name, self.link_extension)
         self.lflags('-shared')
     try:
         os.makedirs(self.build_directory)
     except OSError:
         pass
     # Stops extra parameters from existing
     self.linker_flags = list(set(self.linker_flags))
     run_list = ' '.join(flatten([self.executable, '-o', 
                         '{0}/{1}'.format(self.build_directory, self.project_name)] 
                         + self.link_list + self.linker_flags))
     command('[LINK] {0}'.format(self.project_name))
     try:
         subprocess.call(run_list)
     except OSError:
         os.system(run_list)
     return 0
Пример #10
0
Файл: cocoa.py Проект: am0d/bit
 def arch(self, *arches):
     for arch in flatten(list(set(arches))):
         self.compiler.cflags('-arch', arch)
         self.compiler.lflags('-arch', arch)
Пример #11
0
Файл: cocoa.py Проект: am0d/bit
 def framework(self, *frameworks):
     for framework in flatten(list(set(frameworks))):
         self.compiler.lflags('-framework', framework)
Пример #12
0
Файл: cc.py Проект: am0d/bit
 def library(self, *libraries):
     for library in flatten(list(set(libraries))):
         self.lflags('-l{0}'.format(library))
Пример #13
0
Файл: cc.py Проект: am0d/bit
 def libdir(self, *directories):
     for directory in flatten(list(set(directories))):
         self.lflags('-L{0}'.format(directory))
Пример #14
0
Файл: cc.py Проект: am0d/bit
 def incdir(self, *directories):
     for directory in flatten(list(set(directories))):
         self.cflags('-I', directory)
         self.lflags('-I', directory)
Пример #15
0
Файл: cc.py Проект: am0d/bit
 def define(self, *defines):
     for define in flatten(list(set(defines))):
         self.cflags('-D', define)
Пример #16
0
 def lflags(self, *flags):
     for flag in flatten(flags):
         self.linker_flags.append(flags)
Пример #17
0
 def cflags(self, *flags):
     for flag in flatten(flags):
         self.compiler_flags.append(flag)
Пример #18
0
Файл: msvc.py Проект: am0d/bit
 def libdir(self, *directories):
     path_list = [path for path in os.environ['LIB'].split(os.pathsep)]
     for directory in flatten(list(set(directories))):
         path_list.append(directory)
     os.environ['LIB'] = os.pathsep.join(path_list)
Пример #19
0
Файл: unix.py Проект: am0d/bit
 def pkg(self, *scripts):
     for script in flatten(list(set(scripts))):
         cflags = config_script_flags(script, '', '--cflags')
         lflags = config_script_flags(script, '', '--libs')
         self.compiler.cflags(cflags)
         self.compiler.lflags(cflags, lflags)
Пример #20
0
Файл: unix.py Проект: am0d/bit
 def pkg_config(self, *packages):
     for package in flatten(list(set(packages))):
         cflags = config_script_flags('pkg', package, '--cflags')
         lflags = config_script_flags('pkg', package, '--libs')
         self.compiler.cflags(cflags)
         self.compiler.lflags(cflags, lflags)