mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Use regexp for transforming module name into package name (PY-13336)
str.strip() strips all the characters contained in its arguments in no particular order.
This commit is contained in:
@@ -120,7 +120,7 @@ class ModuleRedeclarator(object):
|
||||
init = None
|
||||
try:
|
||||
if self.split_modules:
|
||||
mod_path = self.outfile.strip(".py")
|
||||
mod_path = module_to_package_name(self.outfile)
|
||||
|
||||
fname = build_output_name(mod_path, "__init__")
|
||||
init = fopen(fname, "w")
|
||||
@@ -1093,3 +1093,7 @@ class ModuleRedeclarator(object):
|
||||
for mod_name in sorted_no_case(self.hidden_imports.keys()):
|
||||
out(0, 'import ', mod_name, ' as ', self.hidden_imports[mod_name])
|
||||
out(0, "") # empty line after group
|
||||
|
||||
|
||||
def module_to_package_name(module_name):
|
||||
return re.sub(r"(.*)\.py$", r"\1", module_name)
|
||||
|
||||
Reference in New Issue
Block a user