Check presence of .portage_not_installed file instead of .git directory
to allow using local files also when using Portage from unpacked tarball.
diff --git a/.portage_not_installed b/.portage_not_installed
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/.portage_not_installed
diff --git a/mkrelease.sh b/mkrelease.sh
index 334b4fb..94e90f7 100755
--- a/mkrelease.sh
+++ b/mkrelease.sh
@@ -80,7 +80,7 @@
 
 echo ">>> Building release tree"
 cp -a "${SOURCE_DIR}/"{bin,cnf,doc,man,misc,pym} "${RELEASE_DIR}/" || die "directory copy failed"
-cp "${SOURCE_DIR}/"{DEVELOPING,LICENSE,Makefile,NEWS,README,RELEASE-NOTES,TEST-NOTES} \
+cp "${SOURCE_DIR}/"{.portage_not_installed,DEVELOPING,LICENSE,Makefile,NEWS,README,RELEASE-NOTES,TEST-NOTES} \
 	"${RELEASE_DIR}/" || die "file copy failed"
 
 if [[ ${RUNTESTS} == "true" ]] ; then
diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py
index a643c7f..fdbc4a8 100644
--- a/pym/portage/__init__.py
+++ b/pym/portage/__init__.py
@@ -368,7 +368,7 @@
 _python_interpreter = os.path.realpath(sys.executable)
 _bin_path = PORTAGE_BIN_PATH
 _pym_path = PORTAGE_PYM_PATH
-_working_copy = VERSION == "HEAD"
+_not_installed = os.path.isfile(os.path.join(PORTAGE_BASE_PATH, ".portage_not_installed"))
 
 # Api consumers included in portage should set this to True.
 _internal_caller = False
diff --git a/pym/portage/repository/config.py b/pym/portage/repository/config.py
index c931c86..e0d3173 100644
--- a/pym/portage/repository/config.py
+++ b/pym/portage/repository/config.py
@@ -960,7 +960,7 @@
 	if "PORTAGE_REPOSITORIES" in settings:
 		repoconfigpaths.append(io.StringIO(settings["PORTAGE_REPOSITORIES"]))
 	else:
-		if portage._working_copy:
+		if portage._not_installed:
 			repoconfigpaths.append(os.path.join(PORTAGE_BASE_PATH, "cnf", "repos.conf"))
 		else:
 			repoconfigpaths.append(os.path.join(settings.global_config_path, "repos.conf"))