chiark / gitweb /
import: do set root_dir if running from a repo
authorDaniel Martí <mvdan@mvdan.cc>
Tue, 15 Sep 2015 00:40:44 +0000 (17:40 -0700)
committerDaniel Martí <mvdan@mvdan.cc>
Tue, 15 Sep 2015 00:40:44 +0000 (17:40 -0700)
fdroidserver/import.py

index eddb3238cc7bf4baf139a5cdfe66e8e3420ab63a..c215942b3bd5735391edb6d13f1a2d4283b5a801 100644 (file)
@@ -137,10 +137,7 @@ def get_metadata_from_url(app, url):
         shutil.rmtree(src_dir)
     vcs = common.getvcs(repotype, repo, src_dir)
     vcs.gotorevision(options.rev)
-    if options.subdir:
-        root_dir = os.path.join(src_dir, options.subdir)
-    else:
-        root_dir = src_dir
+    root_dir = get_subdir(src_dir)
 
     app['Repo Type'] = repotype
     app['Repo'] = repo
@@ -152,6 +149,13 @@ config = None
 options = None
 
 
+def get_subdir(src_dir):
+    if options.subdir:
+        return os.path.join(src_dir, options.subdir)
+
+    return src_dir
+
+
 def main():
 
     global config, options
@@ -173,9 +177,13 @@ def main():
     package, app = metadata.get_default_app_info_list(apps)
     app['Update Check Mode'] = "Tags"
 
+    root_dir = None
+    src_dir = None
+
     if os.path.isdir('.git'):
         if options.url:
             app['Web Site'] = options.url
+        root_dir = get_subdir(os.getcwd())
     elif options.url:
         root_dir, src_dir = get_metadata_from_url(app, options.url)
     else: