Andreas Tille pushed to branch master at Debian Blends Team / website

Commits:
26d8176a by Andreas Tille at 2018-03-12T12:48:39+01:00
Machine readable files output: 1. *.vcs file (simply storing where the files 
were found)

- - - - -


1 changed file:

- misc/machine_readable/fetch-machine-readable_salsa.py


Changes:

=====================================
misc/machine_readable/fetch-machine-readable_salsa.py
=====================================
--- a/misc/machine_readable/fetch-machine-readable_salsa.py
+++ b/misc/machine_readable/fetch-machine-readable_salsa.py
@@ -2,8 +2,7 @@
 
 import gitlab
 import os
-
-PER_PAGE=99
+import shutil
 
 BLENDSGROUPS=[ 'Debian 3D Printing Team'
              , 'Debian Accessibility Team'
@@ -22,6 +21,17 @@ BLENDSGROUPS=[ 'Debian 3D Printing Team'
              , 'Debichem'
              ]
 
+# just start with one team
+BLENDSGROUPS=[ 'Debian Med' ]
+
+TDNAME='machine-readable'
+MACHINEREADABLEARCHIVE='/srv/blends.debian.org/www/_'+TDNAME+'/'+TDNAME+'.tar.xz'
+READMEDEBIANARCHIVE='/srv/blends.debian.org/www/_'+TDNAME+'/README.Debian.tar.xz'
+TARGETDIR=os.path.join(os.environ['HOME'],TDNAME)
+# cleanup TARGETDIR first
+shutil.rmtree(TARGETDIR)
+os.makedirs(TARGETDIR)
+
 def get_blends_groups():
     blends_groups=[]
     groups = gl.groups.list(all=True, order_by='name', sort='asc')
@@ -38,9 +48,17 @@ gl = gitlab.Gitlab("https://salsa.debian.org";) # , 
private_token=SALSA_TOKEN) # 
 blends_groups = get_blends_groups()
 for group in blends_groups:
     print(group.attributes['name'], group.attributes['id'], 
group.attributes['path']) # , group.attributes['description'], 
group.attributes['full_name'])
+    gpath = group.attributes['path']
     projects = group.projects.list(all=True, order_by='name', sort='asc')
     for project in projects:
-        print("   ", project.attributes['name'])
+        name = project.attributes['name']
+        namedir = os.path.join(TARGETDIR, name[0])
+        if not os.path.exists(namedir):
+            os.makedirs(namedir)
+        with open(os.path.join(namedir,name+'.vcs'), 'w') as out:
+            out.write("Vcs-Browser: g...@salsa.debian.org:%s/%s\n" % (gpath, 
name))
+            out.write("Vcs-Git: g...@salsa.debian.org:%s/%s.git\n" % (gpath, 
name))
+        out.close()
 
 #for project in git.getall(git.getprojects):
 #    print(project['name'], project['path_with_namespace'], project['id'])



View it on GitLab: 
https://salsa.debian.org/blends-team/website/commit/26d8176a0565f4683f3ea573cb4d6aaed06541aa

---
View it on GitLab: 
https://salsa.debian.org/blends-team/website/commit/26d8176a0565f4683f3ea573cb4d6aaed06541aa
You're receiving this email because of your account on salsa.debian.org.
_______________________________________________
Blends-commit mailing list
Blends-commit@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/blends-commit

Reply via email to