def choose_test_files_and_tar(local_nodejs_path, node_version): ''' choose all the test files and directories so that we start tests. 1. Generate a new temporary directory 2. Copy all the files and directories to the temporary directory. 3. tar -cjf node-<version>-release.tar @fn choose_test_files_and_tar @param local_nodejs_path @param node_version @return ''' apprt_files_dir = os.path.abspath(os.path.dirname(local_nodejs_path)) node_test_dir = os.path.join(apprt_files_dir, 'node_%s_test' % node_version) if os.path.exists(node_test_dir): shutil.rmtree(node_test_dir) os.mkdir(node_test_dir) if os.path.exists('%s.tar' % node_test_dir): os.unlink('%s.tar' % node_test_dir) # The 3 directories are certain to be used sys.stdout.write('Removing blacklist tests') sys.stdout.flush() remove_blacklist(apprt_files_dir, node_version) copy_dirs = ['tools', 'test', 'deps/v8/tools'] for single_dir in copy_dirs: shutil.copytree(os.path.join(local_nodejs_path, single_dir), os.path.join(node_test_dir, single_dir)) for filename in os.listdir(local_nodejs_path): file_path = os.path.join(local_nodejs_path, filename) if os.path.isfile(file_path): shutil.copyfile(file_path, os.path.join(node_test_dir, filename)) compact_cmd = ['tar', '-cf'] compact_cmd.append('%s.tar' % node_test_dir) compact_cmd.append('node_%s_test' % node_version) p = subprocess.Popen(compact_cmd, cwd=apprt_files_dir) p.wait() return p.returncode
def choose_test_files_and_tar(local_nodejs_path, node_version): ''' choose all the test files and directories so that we start tests. 1. Generate a new temporary directory 2. Copy all the files and directories to the temporary directory. 3. tar -cjf node-<version>-release.tar @fn choose_test_files_and_tar @param local_nodejs_path @param node_version @return ''' apprt_files_dir = os.path.abspath(os.path.dirname(local_nodejs_path)) node_test_dir = os.path.join(apprt_files_dir, 'node_%s_test' % node_version) if os.path.exists(node_test_dir): shutil.rmtree(node_test_dir) os.mkdir(node_test_dir) if os.path.exists('%s.tar' % node_test_dir): os.unlink('%s.tar' % node_test_dir) # The 3 directories are certain to be used copy_dirs = ['tools', 'test', 'deps/v8/tools'] for single_dir in copy_dirs: shutil.copytree(os.path.join(local_nodejs_path, single_dir), os.path.join(node_test_dir, single_dir)) for filename in os.listdir(local_nodejs_path): file_path = os.path.join(local_nodejs_path, filename) if os.path.isfile(file_path): shutil.copyfile(file_path, os.path.join(node_test_dir, filename)) sys.stdout.write('\nRemoving blacklist tests') sys.stdout.flush() remove_blacklist(apprt_files_dir, node_version) compact_cmd = ['tar', '-cf'] compact_cmd.append('%s.tar' % node_test_dir) compact_cmd.append('node_%s_test' % node_version) p = subprocess.Popen(compact_cmd, cwd=apprt_files_dir) p.wait() return p.returncode