without-init.patch 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. --- contrib/tools/cython/Cython/Compiler/Main.py (b77cbecdf03a4bc1fd125fecb66a5e8e8ce8cc5e)
  2. +++ contrib/tools/cython/Cython/Compiler/Main.py (71a3090d95d1027557404facb18ee15edc4090fc)
  3. @@ -827,27 +827,15 @@ def search_include_directories(dirs, qualified_name, suffix, pos, include=False)
  4. if os.path.exists(path):
  5. return path
  6. + # Arcadia-specific lookup: search for packages in include paths,
  7. + # ignoring existence of __init__.py files as packages markers
  8. + # (they are not required by Arcadia build system)
  9. if not include:
  10. - package_dir = Utils.check_package_dir(dirname, package_names)
  11. - if package_dir is not None:
  12. - path = os.path.join(package_dir, module_filename)
  13. - if os.path.exists(path):
  14. - return path
  15. - path = os.path.join(package_dir, module_name,
  16. - package_filename)
  17. - if os.path.exists(path):
  18. - return path
  19. -
  20. - # Arcadia-specific lookup: search for packages in include paths,
  21. - # ignoring existence of __init__.py files as packages markers
  22. - # (they are not required by Arcadia build system)
  23. - if not include:
  24. - for dir in dirs:
  25. - package_dir = os.path.join(dir, *package_names)
  26. + package_dir = os.path.join(dirname, *package_names)
  27. path = os.path.join(package_dir, module_filename)
  28. if os.path.exists(path):
  29. return path
  30. - path = os.path.join(dir, package_dir, module_name,
  31. + path = os.path.join(dirname, package_dir, module_name,
  32. package_filename)
  33. if os.path.exists(path):
  34. return path
  35. --- contrib/tools/cython/Cython/Compiler/Nodes.py (b77cbecdf03a4bc1fd125fecb66a5e8e8ce8cc5e)
  36. +++ contrib/tools/cython/Cython/Compiler/Nodes.py (71a3090d95d1027557404facb18ee15edc4090fc)
  37. @@ -7992,7 +7992,7 @@ class FromCImportStatNode(StatNode):
  38. if self.relative_level and self.relative_level > env.qualified_name.count('.'):
  39. error(self.pos, "relative cimport beyond main package is not allowed")
  40. return
  41. - module_scope = env.find_module(self.module_name, self.pos, relative_level=self.relative_level)
  42. + module_scope = env.find_module(self.module_name, self.pos, relative_level=self.relative_level, need_pxd=0)
  43. module_name = module_scope.qualified_name
  44. env.add_imported_module(module_scope)
  45. for pos, name, as_name, kind in self.imported_names:
  46. --- contrib/tools/cython/Cython/Compiler/Symtab.py (b77cbecdf03a4bc1fd125fecb66a5e8e8ce8cc5e)
  47. +++ contrib/tools/cython/Cython/Compiler/Symtab.py (71a3090d95d1027557404facb18ee15edc4090fc)
  48. @@ -1250,7 +1250,7 @@ class ModuleScope(Scope):
  49. entry.qualified_name = self.builtin_scope().qualify_name(name)
  50. return entry
  51. - def find_module(self, module_name, pos, relative_level=-1):
  52. + def find_module(self, module_name, pos, relative_level=-1, need_pxd=1):
  53. # Find a module in the import namespace, interpreting
  54. # relative imports relative to this module's parent.
  55. # Finds and parses the module's .pxd file if the module
  56. @@ -1271,7 +1271,7 @@ class ModuleScope(Scope):
  57. module_scope = self.global_scope()
  58. return module_scope.context.find_module(
  59. - module_name, relative_to=relative_to, pos=pos, absolute_fallback=absolute_fallback)
  60. + module_name, relative_to=relative_to, pos=pos, absolute_fallback=absolute_fallback, need_pxd=need_pxd)
  61. def find_submodule(self, name):
  62. # Find and return scope for a submodule of this module,