marvin-zhao / pyang

Automatically exported from code.google.com/p/pyang
0 stars 0 forks source link

Circular import is sometimes undetected #46

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Circular import of modules is sometimes not detected. The two modules below are 
completely symmetrical but circular dependency is only reported for prefclashx:

module prefclash {
  namespace "http://prefclash";
  prefix a;
  import prefclashx {
    prefix a1;
  }
  leaf a {
    must "/a1:a < .";
    type uint8;
  }
}
$ cat prefclashx.yang 
module prefclashx {
  namespace "http://prefclashx";
  prefix a;
  import prefclash {
    prefix a1;
  }
  leaf a {
    must "/a1:a > .";
    type uint8;
  }
}
$ pyang prefclash.yang 
$ pyang prefclashx.yang 
prefclash.yin:7: error: circular dependency for module "prefclashx"

Original issue reported on code.google.com by lada.lho...@gmail.com on 24 Jun 2010 at 7:09

GoogleCodeExporter commented 9 years ago
This is actually a side effect of the fact that YIN versions of the same 
modules were present in the same directory, but in prefclashx.yin the 'import' 
statement was removed. The 'import' statement from a YANG file actually imports 
YIN file.

I think we need to specify exactly the search order, including the YIN and YANG 
versions of the same module.

It might also make sense to provide just module names at the command line 
instead of file names:

$ pyang foo

Original comment by lada.lho...@gmail.com on 24 Jun 2010 at 7:27

GoogleCodeExporter commented 9 years ago
I think it is ok if it is unspecified which file is loaded if there is both a 
yin and yang file in the same directory.

Original comment by mbj4...@gmail.com on 6 Oct 2010 at 10:37