anchor.diff:  "
   
   DEBIAN_PATCH_TYPE = "quilt"
  -#DEBIAN_PATCH_TYPE = "abnormal"
   
   inherit multilib_header python3native pkgconfig
   
  
positive.code: require python3.inc
  
  DEPENDS = "python3-native libffi bzip2 db gdbm openssl readline sqlite3 zlib virtual/libintl xz expat mpdecimal"
  PR = "${INC_PR}"
  
  PYTHON_BINABI= "${PYTHON_MAJMIN}m"
  # now-avoid-pgen.patch
  
negative.code: RRECOMMENDS_${PN}-crypt = "openssl"
  RRECOMMENDS_${PN}-crypt_class-nativesdk = "nativesdk-openssl"
  
  FILES_${PN}-2to3 += "${bindir}/2to3-${PYTHON_MAJMIN}"
  FILES_${PN}-pydoc += "${bindir}/pydoc${PYTHON_MAJMIN} ${bindir}/pydoc3"
  
  PACKAGES =+ "${PN}-pyvenv"
  FILES_${PN}-pyvenv += "${bindir}/pyvenv-${PYTHON_MAJMIN} \
                         ${libdir}/python${PYTHON_MAJMIN}/ensurepip/* \
                         "
  
  # package libpython3
  PACKAGES =+ "libpython3 libpython3-staticdev"
  FILES_libpython3 = "${libdir}/libpython*.so.*"
  FILES_libpython3-staticdev += "${libdir}/python${PYTHON_MAJMIN}/config-${PYTHON_BINABI}/libpython${PYTHON_BINABI}.a"
  
  # catch debug extensions (isn't that already in python-core-dbg?)
  FILES_${PN}-dbg += "${libdir}/python${PYTHON_MAJMIN}/lib-dynload/.debug"
  
  # catch manpage
  PACKAGES += "${PN}-man"
  FILES_${PN}-man = "${datadir}/man"
  
  #
  # Provide packages as Debian
  # but keep compatible with poky
  #
  
  # Get list file of libpython3.4-minimal
  python do_package_prepend() {
      import re, os
  
      dpn = d.getVar("DPN", True) or ""
      s = d.getVar("S", True) or ""
      libdir = d.getVar("libdir", True) or ""
      sysconfdir = d.getVar("sysconfdir", True) or ""
      python_majmin = d.getVar("PYTHON_MAJMIN", True) or ""
      scriptdir = "%s/python%s" % (libdir, python_majmin)
  
      readme_lmin = "%s/debian/PVER-minimal.README.Debian.in" % s
      p_lmin = "lib%s-minimal" % dpn
      files_lmin = d.getVar("FILES_%s" % p_lmin, True) or ""
  
      # get list file from debian/PVER-minimal.README.Debian.in
      # base on debian/rule (line71 - line85)
      patern_mods = '^[ ]+\\w*\\t*module\\s*'
      patern_exts = '^[ ]+\\w*\\t*extension\\w*\\s*'
      patern_packages = '^[ ]+\\w*\\t*package\\s*'
      min_mods = []
      min_exts = []
      min_packages = []
      min_encodings = []
  
      with open(readme_lmin, 'r') as f:
          lines = f.readlines()
          for line in lines:
              sline = line.split()
              if re.match(patern_mods,line):
                  min_mods.append(sline[0])
              if re.match(patern_exts,line):
                  min_exts.append(sline[0])
              if re.match(patern_packages,line):
                  min_packages.append(sline[0])
  
      filterout_encodings = ["big5.*", "bz2.*", "cp932.py", "cp949.py", \
                          "cp950.py", "euc_.*", "gb.*" "iso2022.*", \
                          "johab.py", "shift_jis.*"]
      patern_encodings = "(" + ")|(".join(filterout_encodings) + ")"
      for i in os.listdir("%s/Lib/encodings" % s):
          if i.endswith(".py") and not re.match(patern_encodings,i):
              min_encodings.append("encodings/%s" % i)
      min_encodings.append("codecs.py")
      min_encodings.append("stringprep.py")
  
      # base on debian/rule (line841 - line851)
      for i in min_mods:
          files_lmin += " %s/%s.py" % (scriptdir, i)
      for i in min_packages:
          files_lmin += " %s/%s" % (scriptdir, i)
      for i in min_encodings:
          files_lmin += " %s/%s" % (scriptdir, i)
      for i in min_exts:
          files_lmin += " %s/lib-dynload/%s.*.so" % (scriptdir, i)
  
      files_lmin += " \
              %s/site.py \
              %s/_sysconfigdata.py \
              %s/plat-*/_sysconfigdata_m.py \
              %s/python%s/sitecustomize.py \
              %s/python%s/sitecustomize.py" \
          % (scriptdir,scriptdir,scriptdir,scriptdir,python_majmin,sysconfdir,python_majmin)
      d.setVar("FILES_%s" % p_lmin,files_lmin)
  }
  
  PACKAGES =+ "${DPN}-minimal ${DPN}-dev idle-${DPN} lib${DPN}-testsuite"
  PACKAGES += "${DPN}-examples lib${DPN}-minimal lib${DPN}-stdlib"
  
  FILES_${DPN}-minimal = " \
      ${bindir}/python${PYTHON_MAJMIN} \
      ${bindir}/python${PYTHON_BINABI} \
  "
  FILES_${DPN}-dev = "${bindir}/python*-config"
  FILES_lib${DPN}-testsuite = " \
      ${libdir}/python${PYTHON_MAJMIN}/*/tests \
      ${libdir}/python${PYTHON_MAJMIN}/ctypes/test \
      ${libdir}/python${PYTHON_MAJMIN}/idlelib/idle_test \
      ${libdir}/python${PYTHON_MAJMIN}/tkinter/test \
      ${libdir}/python${PYTHON_MAJMIN}/unittest/test \
  "
  FILES_${PN}-core = "${bindir}/*"
  FILES_${PN}-dev += " \
      ${libdir}/python${PYTHON_MAJMIN}/*.so \
      ${libdir}/python${PYTHON_MAJMIN}/config-${PYTHON_BINABI} \
  "
  FILES_${DPN}-examples = " \
      ${libdir}/python${PYTHON_MAJMIN}/turtledemo \
      ${docdir}/python${PYTHON_MAJMIN}/examples \
  "
  FILES_lib${DPN}-stdlib = "${libdir}/python${PYTHON_MAJMIN}"
  FILES_idle-${DPN} = "${bindir}/idle-python${PYTHON_MAJMIN}"
  
  DEBIANNAME_lib${DPN}-minimal = "lib${DPN}-minimal"
  DEBIANNAME_lib${DPN}-stdlib = "lib${DPN}-stdlib"
  DEBIANNAME_lib${DPN}-testsuite = "lib${DPN}-testsuite"
  
  # python3-pyvenv as python3.4-venv
  RPROVIDES_${PN}-pyvenv += "${DPN}-venv"
  DEBIANNAME_${PN}-pyvenv = "${DPN}-venv"
  # libpython3 as libpython3.4
  RPROVIDES_libpython3 += "lib${DPN}"
  DEBIANNAME_libpython3 = "lib${DPN}"
  # python3-dev as libpython3.4-dev
  RPROVIDES_${PN}-dev += "lib${DPN}-dev"
  DEBIANNAME_${PN}-dev = "lib${DPN}-dev"
  # python3-core as python3.4
  RPROVIDES_${PN}-core += "${DPN}"
  DEBIANNAME_${PN}-core = "${DPN}"
  # python3-misc as libpython3.4-stdlib
  RPROVIDES_lib${DPN}-stdlib = "${PN}-misc"
  
  RDEPENDS_lib${DPN}-minimal += " \
      ${PN}-codecs ${PN}-compile ${PN}-crypt ${PN}-io ${PN}-importlib \
      ${PN}-lang ${PN}-logging ${PN}-math ${PN}-netclient ${PN}-pickle \
      ${PN}-pkgutil ${PN}-re ${PN}-reprlib ${PN}-textutils ${PN}-threading \
      ${PN}-shell ${PN}-stringold ${PN}-subprocess \
  "
  RDEPENDS_lib${DPN}-stdlib += " \
      ${PN}-2to3 ${PN}-asyncio ${PN}-audio ${PN}-codecs ${PN}-compression \
      ${PN}-ctypes ${PN}-curses ${PN}-datetime ${PN}-db ${PN}-debugger \
      ${PN}-difflib ${PN}-distutils ${PN}-doctest ${PN}-email ${PN}-html \
      ${PN}-idle ${PN}-image ${PN}-io ${PN}-json ${PN}-lang ${PN}-mailbox \
      ${PN}-math ${PN}-mime ${PN}-mmap ${PN}-multiprocessing ${PN}-netclient \
      ${PN}-netserver ${PN}-numbers ${PN}-pickle ${PN}-pprint ${PN}-profile \
      ${PN}-pydoc ${PN}-readline ${PN}-resource ${PN}-shell ${PN}-smtpd \
      ${PN}-sqlite3 ${PN}-terminal ${PN}-textutils ${PN}-threading \
      ${PN}-tkinter ${PN}-unittest ${PN}-unixadmin ${PN}-xml \
  "
  RDEPENDS_${DPN} += "lib${DPN}-minimal lib${DPN}-stdlib"
  RDEPENDS_${DPN}-venv += "${DPN}"
  RDEPENDS_${DPN}-minimal += "lib${DPN}-minimal"
  RDEPENDS_lib${DPN} += "lib${DPN}-stdlib"
  RDEPENDS_${DPN}-examples += "${DPN}"
  RDEPENDS_${DPN}-dev += "${DPN} lib${DPN}-dev lib${DPN}"
  RDEPENDS_lib${DPN}-dev += "lib${DPN}-stdlib"
  RDEPENDS_lib${DPN}-testsuite += "${DPN} ${PN}-tests ${PN}-sqlite3-tests"
  RDEPENDS_idle-${DPN} += "${DPN}"
  
  BBCLASSEXTEND = "nativesdk"
  