@@ -109,37 +109,18 @@ impl LanguagePlugin for Python3Plugin {
109109 setup. exists ( ) || requirements. exists ( ) || test. exists ( ) || tmc. exists ( )
110110 }
111111
112+ // returns the parent of the src directory, if one is found
112113 fn find_project_dir_in_zip < R : Read + Seek > (
113114 zip_archive : & mut ZipArchive < R > ,
114115 ) -> Result < PathBuf , TmcError > {
115116 for i in 0 ..zip_archive. len ( ) {
116117 let file = zip_archive. by_index ( i) ?;
117118 let file_path = file. sanitized_name ( ) ;
118- if file_path. file_name ( ) == Some ( OsStr :: new ( "setup.py" ) )
119- || file_path. file_name ( ) == Some ( OsStr :: new ( "requirements.txt" ) )
120- {
119+ if file_path. file_name ( ) == Some ( OsStr :: new ( "src" ) ) {
121120 if let Some ( parent) = file_path. parent ( ) {
122121 return Ok ( parent. to_path_buf ( ) ) ;
123122 }
124123 }
125- if file_path. file_name ( ) == Some ( OsStr :: new ( "__init__.py" ) ) {
126- if let Some ( init_parent) = file_path. parent ( ) {
127- if init_parent. file_name ( ) == Some ( OsStr :: new ( "test" ) ) {
128- if let Some ( test_parent) = init_parent. parent ( ) {
129- return Ok ( test_parent. to_path_buf ( ) ) ;
130- }
131- }
132- }
133- }
134- if file_path. file_name ( ) == Some ( OsStr :: new ( "__main__.py" ) ) {
135- if let Some ( main_parent) = file_path. parent ( ) {
136- if main_parent. file_name ( ) == Some ( OsStr :: new ( "tmc" ) ) {
137- if let Some ( tmc_parent) = main_parent. parent ( ) {
138- return Ok ( tmc_parent. to_path_buf ( ) ) ;
139- }
140- }
141- }
142- }
143124 }
144125 Err ( TmcError :: NoProjectDirInZip )
145126 }
0 commit comments