feisty meow concerns codebase
2.140
|
Public Member Functions | |
def | __init__ (self, argv) |
def | print_instructions (self) |
def | validate_and_consume_command_line (self) |
def | read_file_data (self, filename) |
def | write_file_data (self, filename) |
def | is_alphanumeric (self, check_char) |
def | replace_within_string (self, fix_string) |
def | process_file_data (self) |
def | replace_all_occurrences (self) |
def | repair_project_references (self) |
def | extract_xml_tag (self, file_line, tag_name) |
def | extract_xml_attribute (self, file_line, tag_name, attribute_name) |
def | extract_xml_tag_from_file (self, filename, tag_name) |
def | extract_guid_from_project_file (self, filename) |
def | extract_filename_from_project_reference (self, file_line) |
def | find_all_project_references (self, filename) |
def | parse_dependency_line (self, line) |
def | extract_dependencies (self, filename) |
def | find_asset_created (self, filename) |
def | walk_directory_for_projects (self, dir) |
def | find_relative_path (self, our_path, project_file) |
def | locate_all_assets (self) |
def | locate_referenced_projects (self, project) |
def | remove_redundant_references (self, project) |
def | unit_test (self) |
Public Attributes | |
arguments | |
file_buffer | |
projects | |
assets | |
phrase_to_replace | |
replacement_bit | |
files | |
file_lines | |
state | |
processed_buffer | |
normal_accumulator | |
comment_accumulator | |
This tool fixes visual studio 2010 projects to have the proper project references. Project files need to refer to other project files that they are dependent on if visual studio is to build them properly. This is a painful task when done manually, but luckily this script automates the process for you. It requires an environment variable called BUILD_TOP that points at the top of all files included in a code base. This is used to find the dependent projects. hmmm: this tool is NOT finished.
Definition at line 6 of file fix_project_references.py.
def fix_project_references.fix_project_references.__init__ | ( | self, | |
argv | |||
) |
Initializes the class with a set of arguments to work with. The arguments need to be in the form described by print_instructions().
Definition at line 21 of file fix_project_references.py.
def fix_project_references.fix_project_references.extract_dependencies | ( | self, | |
filename | |||
) |
reads in a visual studio project file and locates all dependencies. This will produce a list of the lib files used by c++ projects. These are what we need to link up to their providing projects, if they're actually things that we build.
Definition at line 367 of file fix_project_references.py.
References fix_project_references.fix_project_references.file_lines, phrase_replacer.phrase_replacer.file_lines, fix_project_references.fix_project_references.parse_dependency_line(), fix_project_references.fix_project_references.read_file_data(), and phrase_replacer.phrase_replacer.read_file_data().
Referenced by fix_project_references.fix_project_references.locate_referenced_projects().
def fix_project_references.fix_project_references.extract_filename_from_project_reference | ( | self, | |
file_line | |||
) |
given a ProjectReference line, this pulls out just the filename involved.
Definition at line 331 of file fix_project_references.py.
References fix_project_references.fix_project_references.extract_xml_attribute().
Referenced by fix_project_references.fix_project_references.find_all_project_references().
def fix_project_references.fix_project_references.extract_guid_from_project_file | ( | self, | |
filename | |||
) |
reads in a visual studio project file and figures out that project's GUID. note that this will fail horribly if the project has been messed with and is no longer in microsoft's official format.
Definition at line 323 of file fix_project_references.py.
References fix_project_references.fix_project_references.extract_xml_tag_from_file().
Referenced by fix_project_references.fix_project_references.unit_test().
def fix_project_references.fix_project_references.extract_xml_attribute | ( | self, | |
file_line, | |||
tag_name, | |||
attribute_name | |||
) |
locates an XML tag with "tag_name" and returns the value of the "attribute_name".
Definition at line 287 of file fix_project_references.py.
Referenced by fix_project_references.fix_project_references.extract_filename_from_project_reference().
def fix_project_references.fix_project_references.extract_xml_tag | ( | self, | |
file_line, | |||
tag_name | |||
) |
locates an XML tag with "tag_name" and returns the contents of the tag. this currently assumes that the start tag, contents, and end tag are all on the same line of text (which is not a very good assumption in general).
Definition at line 272 of file fix_project_references.py.
Referenced by fix_project_references.fix_project_references.extract_xml_tag_from_file(), fix_project_references.fix_project_references.find_asset_created(), and fix_project_references.fix_project_references.parse_dependency_line().
def fix_project_references.fix_project_references.extract_xml_tag_from_file | ( | self, | |
filename, | |||
tag_name | |||
) |
reads in a file and extracts the contents of a particular XML tag. may not want a file read here. better to have a nice established way for dealing with the existing buffer.
Definition at line 303 of file fix_project_references.py.
References fix_project_references.fix_project_references.extract_xml_tag(), fix_project_references.fix_project_references.file_lines, phrase_replacer.phrase_replacer.file_lines, fix_project_references.fix_project_references.read_file_data(), and phrase_replacer.phrase_replacer.read_file_data().
Referenced by fix_project_references.fix_project_references.extract_guid_from_project_file().
def fix_project_references.fix_project_references.find_all_project_references | ( | self, | |
filename | |||
) |
reads in a visual studio project file and locates all references.
Definition at line 336 of file fix_project_references.py.
References fix_project_references.fix_project_references.extract_filename_from_project_reference(), fix_project_references.fix_project_references.file_lines, phrase_replacer.phrase_replacer.file_lines, fix_project_references.fix_project_references.read_file_data(), and phrase_replacer.phrase_replacer.read_file_data().
Referenced by fix_project_references.fix_project_references.unit_test().
def fix_project_references.fix_project_references.find_asset_created | ( | self, | |
filename | |||
) |
determines the asset created by a visual studio project file. This probably only works right on c++ projects. It will figure out the item being created by the project using the breadcrumbs provided.
Definition at line 389 of file fix_project_references.py.
References fix_project_references.fix_project_references.extract_xml_tag(), fix_project_references.fix_project_references.file_lines, phrase_replacer.phrase_replacer.file_lines, fix_project_references.fix_project_references.read_file_data(), and phrase_replacer.phrase_replacer.read_file_data().
Referenced by fix_project_references.fix_project_references.locate_all_assets(), and fix_project_references.fix_project_references.unit_test().
def fix_project_references.fix_project_references.find_relative_path | ( | self, | |
our_path, | |||
project_file | |||
) |
calculates path between directory at "our_path" to the location of "project_file". this assumes that the locations are actually rooted at the same place; otherwise there is no path between the locations. the location at "our_path" is considered to be the source, or where we start out. the location for "project_file" is the target location.
Definition at line 481 of file fix_project_references.py.
Referenced by fix_project_references.fix_project_references.unit_test().
def fix_project_references.fix_project_references.is_alphanumeric | ( | self, | |
check_char | |||
) |
given a character, this returns true if it's between a-z, A-Z or 0-9.
Definition at line 115 of file fix_project_references.py.
Referenced by fix_project_references.fix_project_references.replace_within_string(), and phrase_replacer.phrase_replacer.replace_within_string().
def fix_project_references.fix_project_references.locate_all_assets | ( | self | ) |
locates every project file in our list and determines the asset created by it. this returns a dictionary of {asset=project} items. we index by asset way more frequently than by project, so the asset name is used as our key.
Definition at line 514 of file fix_project_references.py.
References fix_project_references.fix_project_references.find_asset_created(), and fix_project_references.fix_project_references.projects.
def fix_project_references.fix_project_references.locate_referenced_projects | ( | self, | |
project | |||
) |
finds all the libraries needed by the "project" file and returns their project files.
Definition at line 533 of file fix_project_references.py.
References fix_project_references.fix_project_references.assets, and fix_project_references.fix_project_references.extract_dependencies().
Referenced by fix_project_references.fix_project_references.unit_test().
def fix_project_references.fix_project_references.parse_dependency_line | ( | self, | |
line | |||
) |
given an AdditionalDependencies line, this finds the libs listed.
Definition at line 353 of file fix_project_references.py.
References fix_project_references.fix_project_references.extract_xml_tag().
Referenced by fix_project_references.fix_project_references.extract_dependencies().
def fix_project_references.fix_project_references.print_instructions | ( | self | ) |
Shows the instructions for using this class.
Definition at line 38 of file fix_project_references.py.
References fix_project_references.fix_project_references.arguments, and phrase_replacer.phrase_replacer.arguments.
Referenced by fix_project_references.fix_project_references.replace_all_occurrences(), and phrase_replacer.phrase_replacer.replace_all_occurrences().
def fix_project_references.fix_project_references.process_file_data | ( | self | ) |
iterates through the stored version of the file and replaces the phrase.
Definition at line 156 of file fix_project_references.py.
Referenced by fix_project_references.fix_project_references.replace_all_occurrences(), and phrase_replacer.phrase_replacer.replace_all_occurrences().
def fix_project_references.fix_project_references.read_file_data | ( | self, | |
filename | |||
) |
loads the file into our memory buffer for processing.
Definition at line 77 of file fix_project_references.py.
References fix_project_references.fix_project_references.file_buffer, and open.
Referenced by fix_project_references.fix_project_references.extract_dependencies(), fix_project_references.fix_project_references.extract_xml_tag_from_file(), fix_project_references.fix_project_references.find_all_project_references(), fix_project_references.fix_project_references.find_asset_created(), fix_project_references.fix_project_references.replace_all_occurrences(), and phrase_replacer.phrase_replacer.replace_all_occurrences().
def fix_project_references.fix_project_references.remove_redundant_references | ( | self, | |
project | |||
) |
cleans out any references in "project" to assets that we intend to update. this actually modifies the file. it had better be right.
Definition at line 565 of file fix_project_references.py.
Referenced by fix_project_references.fix_project_references.unit_test().
def fix_project_references.fix_project_references.repair_project_references | ( | self | ) |
the main entry point to the project fixing process. Operates on one project file at a time by: 1) finding all libraries (lib files) used by the project A, 2) locating the external project that creates each lib file, 3) adding a reference to the external projects to our project A. We rely on some important assumptions to get this done: 1) project names and project file names are unique across the codebase, 2) the structure of the source code hierarchies uses a compatible architecture, (which is?)
Definition at line 254 of file fix_project_references.py.
def fix_project_references.fix_project_references.replace_all_occurrences | ( | self | ) |
Orchestrates the process of replacing the phrases.
Definition at line 227 of file fix_project_references.py.
References filesystem::directory.files(), fix_project_references.fix_project_references.files, phrase_replacer.phrase_replacer.files, bundle_creator.print_instructions(), unpacker_stub.print_instructions(), application_example.print_instructions(), ini_editor.print_instructions(), splitter_app.print_instructions(), find_missing.print_instructions(), transporter.print_instructions(), marks_maker_javascript.print_instructions(), link_parser.print_instructions(), marks_checker.print_instructions(), marks_maker.print_instructions(), marks_sorter.print_instructions(), fix_project_references.fix_project_references.print_instructions(), phrase_replacer.phrase_replacer.print_instructions(), fix_project_references.fix_project_references.process_file_data(), phrase_replacer.phrase_replacer.process_file_data(), fix_project_references.fix_project_references.read_file_data(), phrase_replacer.phrase_replacer.read_file_data(), fix_project_references.fix_project_references.validate_and_consume_command_line(), phrase_replacer.phrase_replacer.validate_and_consume_command_line(), fix_project_references.fix_project_references.write_file_data(), and phrase_replacer.phrase_replacer.write_file_data().
def fix_project_references.fix_project_references.replace_within_string | ( | self, | |
fix_string | |||
) |
given a string to fix, this replaces all appropriate locations of the phrase.
Definition at line 128 of file fix_project_references.py.
References textual::parser_bits.is_alphanumeric(), fix_project_references.fix_project_references.is_alphanumeric(), phrase_replacer.phrase_replacer.is_alphanumeric(), fix_project_references.fix_project_references.phrase_to_replace, phrase_replacer.phrase_replacer.phrase_to_replace, fix_project_references.fix_project_references.replacement_bit, and phrase_replacer.phrase_replacer.replacement_bit.
def fix_project_references.fix_project_references.unit_test | ( | self | ) |
a sort-of unit test for the functions in this script. currently geared for manual inspection of the test results.
Definition at line 578 of file fix_project_references.py.
References fix_project_references.fix_project_references.arguments, phrase_replacer.phrase_replacer.arguments, fix_project_references.fix_project_references.extract_guid_from_project_file(), fix_project_references.fix_project_references.find_all_project_references(), fix_project_references.fix_project_references.find_asset_created(), fix_project_references.fix_project_references.find_relative_path(), fix_project_references.fix_project_references.locate_referenced_projects(), and fix_project_references.fix_project_references.remove_redundant_references().
def fix_project_references.fix_project_references.validate_and_consume_command_line | ( | self | ) |
Performs command line argument handling.
Definition at line 59 of file fix_project_references.py.
References fix_project_references.fix_project_references.arguments, and phrase_replacer.phrase_replacer.arguments.
Referenced by fix_project_references.fix_project_references.replace_all_occurrences(), and phrase_replacer.phrase_replacer.replace_all_occurrences().
def fix_project_references.fix_project_references.walk_directory_for_projects | ( | self, | |
dir | |||
) |
traverses the directory in "dir" and finds all the project files. the project files are returned as a massive list.
Definition at line 450 of file fix_project_references.py.
def fix_project_references.fix_project_references.write_file_data | ( | self, | |
filename | |||
) |
takes the processed buffer and sends it back out to the filename.
Definition at line 94 of file fix_project_references.py.
References fix_project_references.fix_project_references.file_buffer, open, fix_project_references.fix_project_references.processed_buffer, and phrase_replacer.phrase_replacer.processed_buffer.
Referenced by fix_project_references.fix_project_references.replace_all_occurrences(), and phrase_replacer.phrase_replacer.replace_all_occurrences().
fix_project_references.fix_project_references.arguments |
Definition at line 26 of file fix_project_references.py.
Referenced by fix_project_references.fix_project_references.print_instructions(), phrase_replacer.phrase_replacer.print_instructions(), fix_project_references.fix_project_references.unit_test(), fix_project_references.fix_project_references.validate_and_consume_command_line(), and phrase_replacer.phrase_replacer.validate_and_consume_command_line().
fix_project_references.fix_project_references.assets |
Definition at line 33 of file fix_project_references.py.
Referenced by fix_project_references.fix_project_references.locate_referenced_projects().
fix_project_references.fix_project_references.comment_accumulator |
Definition at line 162 of file fix_project_references.py.
Referenced by phrase_replacer.phrase_replacer.emit_comment_accumulator().
fix_project_references.fix_project_references.file_buffer |
Definition at line 27 of file fix_project_references.py.
Referenced by fix_project_references.fix_project_references.read_file_data(), and fix_project_references.fix_project_references.write_file_data().
fix_project_references.fix_project_references.file_lines |
Definition at line 91 of file fix_project_references.py.
Referenced by fix_project_references.fix_project_references.extract_dependencies(), fix_project_references.fix_project_references.extract_xml_tag_from_file(), fix_project_references.fix_project_references.find_all_project_references(), and fix_project_references.fix_project_references.find_asset_created().
fix_project_references.fix_project_references.files |
Definition at line 70 of file fix_project_references.py.
Referenced by fix_project_references.fix_project_references.replace_all_occurrences(), and phrase_replacer.phrase_replacer.replace_all_occurrences().
fix_project_references.fix_project_references.normal_accumulator |
Definition at line 161 of file fix_project_references.py.
fix_project_references.fix_project_references.phrase_to_replace |
Definition at line 67 of file fix_project_references.py.
Referenced by fix_project_references.fix_project_references.replace_within_string(), and phrase_replacer.phrase_replacer.replace_within_string().
fix_project_references.fix_project_references.processed_buffer |
Definition at line 160 of file fix_project_references.py.
Referenced by phrase_replacer.phrase_replacer.emit_comment_accumulator(), fix_project_references.fix_project_references.write_file_data(), and phrase_replacer.phrase_replacer.write_file_data().
fix_project_references.fix_project_references.projects |
Definition at line 32 of file fix_project_references.py.
Referenced by fix_project_references.fix_project_references.locate_all_assets().
fix_project_references.fix_project_references.replacement_bit |
Definition at line 68 of file fix_project_references.py.
Referenced by fix_project_references.fix_project_references.replace_within_string(), and phrase_replacer.phrase_replacer.replace_within_string().
fix_project_references.fix_project_references.state |
Definition at line 158 of file fix_project_references.py.