public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/sci:master commit in: dev-python/busfactor/, dev-python/busfactor/files/0.2/, dev-python/gitana/, ...
@ 2017-03-26  8:18 Justin Lecher
  0 siblings, 0 replies; only message in thread
From: Justin Lecher @ 2017-03-26  8:18 UTC (permalink / raw
  To: gentoo-commits

commit:     2508ea29c4d28fd0cb71c7a82897bf3484a4bda7
Author:     Harald Weiner <timeraider4u <AT> users <DOT> noreply <DOT> github <DOT> com>
AuthorDate: Sat Mar 25 09:16:20 2017 +0000
Commit:     Justin Lecher <jlec <AT> gentoo <DOT> org>
CommitDate: Sat Mar 25 09:16:20 2017 +0000
URL:        https://gitweb.gentoo.org/proj/sci.git/commit/?id=2508ea29

dev-python/busfactor: added new ebuild (#692)

Package-Manager: portage-2.3.3 repoman-2.3.1

Drop leftover from CVS in HEADER
More fixes requested by code review
Use PYTHON_REQ

 dev-python/busfactor/busfactor-0.2.ebuild          |  34 ++++++
 dev-python/busfactor/files/0.2/main.py             |   7 ++
 dev-python/busfactor/files/0.2/setup.py.patch      |  23 ++++
 dev-python/busfactor/metadata.xml                  |  12 ++
 dev-python/gitana/files/0.2/case_study.py.patch    |  10 ++
 dev-python/gitana/files/0.2/db2json_gui.py.patch   |  67 +++++++++++
 dev-python/gitana/files/0.2/git2db.py.patch        |  28 +++++
 dev-python/gitana/files/0.2/git2db_gui.py.patch    | 124 +++++++++++++++++++++
 dev-python/gitana/files/0.2/gitana.py.patch        |  22 ++++
 dev-python/gitana/files/0.2/gitana_gui.py.patch    |  53 +++++++++
 .../gitana/files/0.2/gitquerier_gitpython.py.patch |  39 +++++++
 dev-python/gitana/files/0.2/init.py                |   1 +
 dev-python/gitana/files/0.2/init_dbschema.py.patch |  20 ++++
 dev-python/gitana/files/0.2/setup.py               |  39 +++++++
 dev-python/gitana/files/0.2/updatedb.py.patch      |  29 +++++
 dev-python/gitana/files/0.2/updatedb_gui.py.patch  |  64 +++++++++++
 dev-python/gitana/gitana-0.2.ebuild                |  76 +++++++++++++
 dev-python/gitana/metadata.xml                     |  12 ++
 18 files changed, 660 insertions(+)

diff --git a/dev-python/busfactor/busfactor-0.2.ebuild b/dev-python/busfactor/busfactor-0.2.ebuild
new file mode 100644
index 000000000..17c263dfa
--- /dev/null
+++ b/dev-python/busfactor/busfactor-0.2.ebuild
@@ -0,0 +1,34 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PYTHON_COMPAT=( python2_7 )
+PYTHON_REQ_USE="tk"
+
+inherit distutils-r1 eutils
+
+DESCRIPTION="A bus factor analyzer for Git repositories"
+HOMEPAGE="https://github.com/SOM-Research/busfactor"
+SRC_URI="https://timeraider4u.github.io/distfiles/files/${P}.tar.gz -> ${P}.tar.gz"
+
+LICENSE="MIT"
+SLOT="0"
+IUSE=""
+
+KEYWORDS="~amd64 ~x86"
+
+DEPEND=""
+RDEPEND="${DEPEND}
+	~dev-python/gitana-${PV}[${PYTHON_USEDEP}]"
+
+PATCHES=(
+	"${FILESDIR}/${PV}/setup.py.patch"
+)
+
+src_prepare() {
+	cp "${FILESDIR}/${PV}/main.py" "${S}/main.py" \
+		|| die "Could not copy '${FILESDIR}/${PV}/main.py' to '${S}/main.py'"
+	# patches are applied by distutils-r1.eclass
+	distutils-r1_python_prepare_all
+}

diff --git a/dev-python/busfactor/files/0.2/main.py b/dev-python/busfactor/files/0.2/main.py
new file mode 100644
index 000000000..b4e863df2
--- /dev/null
+++ b/dev-python/busfactor/files/0.2/main.py
@@ -0,0 +1,7 @@
+import bus_factor_gui
+
+def main():
+	bus_factor_gui.main("")
+
+if __name__ == "__main__":
+	main()

diff --git a/dev-python/busfactor/files/0.2/setup.py.patch b/dev-python/busfactor/files/0.2/setup.py.patch
new file mode 100644
index 000000000..5a846ffad
--- /dev/null
+++ b/dev-python/busfactor/files/0.2/setup.py.patch
@@ -0,0 +1,23 @@
+--- a/setup.py	2017-02-23 13:31:01.608732993 +0100
++++ b/setup.py	2017-02-23 13:33:44.290607540 +0100
+@@ -10,7 +10,8 @@
+ 	https://github.com/pypa/sampleproject
+ """
+ 
+-from distutils.core import setup
++"""from distutils.core import setup"""
++from setuptools import setup
+ 
+ setup(name='busfactor',
+ 	version='0.2',
+@@ -26,4 +27,10 @@
+ 							 'data/*.json', 'js/*.js', 'js/bootstrap/*.js',
+ 							 'js/vendor/*.js', '*.png', 'index.html', 
+ 							 'LICENSE']},
++	entry_points = {
++		"console_scripts": [
++			"busfactor_gui = busfactor.main:main",
++		]
++	},
++	
+ )

diff --git a/dev-python/busfactor/metadata.xml b/dev-python/busfactor/metadata.xml
new file mode 100644
index 000000000..ec9fa9d47
--- /dev/null
+++ b/dev-python/busfactor/metadata.xml
@@ -0,0 +1,12 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+	<maintainer type="person">
+		<email>harald.weiner@jku.at</email>
+		<name>Harald Weiner</name>
+	</maintainer>
+	<maintainer type="project">
+		<email>sci@gentoo.org</email>
+		<name>Gentoo Science Project</name>
+	</maintainer>
+</pkgmetadata>

diff --git a/dev-python/gitana/files/0.2/case_study.py.patch b/dev-python/gitana/files/0.2/case_study.py.patch
new file mode 100644
index 000000000..338e42bf1
--- /dev/null
+++ b/dev-python/gitana/files/0.2/case_study.py.patch
@@ -0,0 +1,10 @@
+diff --git a/case_study.py b/case_study.py
+index 6ec3a5a..fdc2711 100644
+--- a/case_study.py
++++ b/case_study.py
+@@ -18,4 +18,4 @@ for repo in repos:
+     g = Gitana(schema)
+     g.init_dbschema(schema)
+     g.git2db(schema, repo[2])
+-    print schema + " done!"
++    print (schema + " done!")

diff --git a/dev-python/gitana/files/0.2/db2json_gui.py.patch b/dev-python/gitana/files/0.2/db2json_gui.py.patch
new file mode 100644
index 000000000..53a657dcc
--- /dev/null
+++ b/dev-python/gitana/files/0.2/db2json_gui.py.patch
@@ -0,0 +1,67 @@
+diff --git a/db2json_gui.py b/db2json_gui.py
+index 3edc13c..8dcb622 100644
+--- a/db2json_gui.py
++++ b/db2json_gui.py
+@@ -2,6 +2,7 @@ __author__ = 'atlanmod'
+ 
+ from Tkinter import *
+ from tkFileDialog import *
++import tkMessageBox
+ import ttk
+ import threading
+ import os
+@@ -137,6 +138,22 @@ class DB2JSON_GUI(Tk):
+         labelExecuting.grid(column=0, row=16, sticky='EW')
+ 
+         self.resizable(False, False)
++        
++        # TKinker is not thread safe!
++        # See http://stackoverflow.com/questions/22541693/tkinter-and-thread-out-of-stack-space-infinite-loop
++        self.resetButtons = False
++        self.importingFailureMsg = ""
++        def do_every_50_ms(self):
++            if self.resetButtons:
++                self.buttonFinish.config(state=NORMAL)
++                self.buttonAbort.config(state=DISABLED)
++                self.resetButtons = False
++            if self.importingFailureMsg:
++                tkMessageBox.showerror("Importing GIT repository failed:", 
++                                       self.importingFailureMsg)
++                self.importingFailureMsg = ""
++            self.after(50, do_every_50_ms, self)
++        do_every_50_ms(self)
+ 
+     def search_for_resource(self):
+         f = askopenfilename(parent=self, title='Choose a file',
+@@ -236,6 +253,9 @@ class DB2JSON_GUI(Tk):
+                 self.FILTER = "in"
+             else:
+                 self.FILTER = "out"
++                
++            if not os.path.exists(DB2JSON_GUI.JSON_DIRECTORY_PATH):
++                os.makedirs(DB2JSON_GUI.JSON_DIRECTORY_PATH)
+ 
+             g = Gitana(self.DBNAME)
+             g.db2json(self.DBNAME, self.OUTPUT_JSON, self.LINE_DETAILS)
+@@ -259,13 +279,16 @@ class DB2JSON_GUI(Tk):
+                            self.USER_ALIASES_PATH)
+ 
+             self.info_execution.set("Finished")
+-            self.buttonFinish.config(state=NORMAL)
+-            self.buttonAbort.config(state=DISABLED)
++            #self.buttonFinish.config(state=NORMAL)
++            #self.buttonAbort.config(state=DISABLED)
++            self.resetButtons = True
+         except Exception as e:
+-            print traceback.format_exc()
++            print( traceback.format_exc())
+             self.info_execution.set("Failed")
+-            self.buttonFinish.config(state=NORMAL)
+-            self.buttonAbort.config(state=DISABLED)
++            #self.buttonFinish.config(state=NORMAL)
++            #self.buttonAbort.config(state=DISABLED)
++            self.importingFailureMsg = traceback.format_exc(limit=1)
++            self.resetButtons = True
+ 
+     def start_export(self):
+         label = Label(self, text=id)

diff --git a/dev-python/gitana/files/0.2/git2db.py.patch b/dev-python/gitana/files/0.2/git2db.py.patch
new file mode 100644
index 000000000..5bec4900c
--- /dev/null
+++ b/dev-python/gitana/files/0.2/git2db.py.patch
@@ -0,0 +1,28 @@
+diff --git a/git2db.py b/git2db.py
+index 8bd727f..688b7e2 100644
+--- a/git2db.py
++++ b/git2db.py
+@@ -15,14 +15,14 @@ FULL_IMPORT_TYPE = 3
+ 
+ class Git2Db():
+ 
+-    def __init__(self, db_name, git_repo_path, before_date, import_last_commit, import_type, logger):
++    def __init__(self, db_name, git_repo_path, before_date, import_last_commit, import_type, logger, branch):
+         self.logger = logger
+         self.git_repo_path = git_repo_path
+         self.db_name = db_name
+         self.before_date = before_date
+         self.import_last_commit = import_last_commit
+         self.import_type = import_type
+-        self.querier = GitQuerier(git_repo_path, logger)
++        self.querier = GitQuerier(git_repo_path, logger, branch)
+ 
+         self.cnx = mysql.connector.connect(**config_db.CONFIG)
+         self.set_database()
+@@ -430,4 +430,4 @@ class Git2Db():
+         minutes_and_seconds = divmod((end_time-start_time).total_seconds(), 60)
+         self.logger.info("Git2Db: process finished after " + str(minutes_and_seconds[0])
+                      + " minutes and " + str(round(minutes_and_seconds[1], 1)) + " secs")
+-        return
+\ No newline at end of file
++        return

diff --git a/dev-python/gitana/files/0.2/git2db_gui.py.patch b/dev-python/gitana/files/0.2/git2db_gui.py.patch
new file mode 100644
index 000000000..1c2385f8a
--- /dev/null
+++ b/dev-python/gitana/files/0.2/git2db_gui.py.patch
@@ -0,0 +1,124 @@
+diff --git a/git2db_gui.py b/git2db_gui.py
+index a515bf2..8bceab4 100644
+--- a/git2db_gui.py
++++ b/git2db_gui.py
+@@ -2,6 +2,7 @@ __author__ = 'atlanmod'
+ 
+ from Tkinter import *
+ from tkFileDialog import *
++import tkMessageBox
+ import threading
+ import os
+ import re
+@@ -57,11 +58,19 @@ class Git2DB_GUI(Tk):
+         self.beforeDateVariable = StringVar()
+         self.beforeDate = Entry(self, textvariable=self.beforeDateVariable, width=30)
+         self.beforeDate.grid(column=1, row=5, sticky='W')
++        
++        #insert branch only
++        labelBranch = Label(self, text=u"Include this branch only (e.g. origin/master)", anchor="w")
++        labelBranch.grid(column=0, row=6, sticky='W')
++
++        self.branchVariable = StringVar()
++        self.entryBranch = Entry(self, textvariable=self.branchVariable, width=30)
++        self.entryBranch.grid(column=1, row=6, sticky='W')
+ 
+         ##########################
+         #empty label
+         emptyLabel = Label(self, anchor="w")
+-        emptyLabel.grid(column=0, row=6, sticky='WE')
++        emptyLabel.grid(column=0, row=7, sticky='WE')
+         ##########################
+ 
+         #select import process
+@@ -71,30 +80,46 @@ class Git2DB_GUI(Tk):
+         self.importProcessType2 = Radiobutton(self, text="Medium mode (patch contents)", variable=self.importProcessTypeVariable, value=2)
+         self.importProcessType3 = Radiobutton(self, text="Full mode (patch line details)", variable=self.importProcessTypeVariable, value=3)
+ 
+-        self.importProcessType1.grid(column=0, row=7, sticky='W')
+-        self.importProcessType2.grid(column=0, row=8, sticky='W')
+-        self.importProcessType3.grid(column=0, row=9, sticky='W')
++        self.importProcessType1.grid(column=0, row=8, sticky='W')
++        self.importProcessType2.grid(column=0, row=9, sticky='W')
++        self.importProcessType3.grid(column=0, row=10, sticky='W')
+ 
+         ##########################
+         #empty label
+         emptyLabel = Label(self, anchor="w")
+-        emptyLabel.grid(column=0, row=10, sticky='WE')
++        emptyLabel.grid(column=0, row=11, sticky='WE')
+         ##########################
+ 
+         #Finish button
+         self.buttonFinish = Button(self, text=u"Import", command=self.launch_thread_execute)
+-        self.buttonFinish.grid(column=1, row=11, sticky="E")
++        self.buttonFinish.grid(column=1, row=12, sticky="E")
+ 
+         #Abort interrupt
+         self.buttonAbort = Button(self, text=u"Abort", command=self.launch_thread_interrupt)
+-        self.buttonAbort.grid(column=2, row=11, sticky="E")
++        self.buttonAbort.grid(column=2, row=12, sticky="E")
+         self.buttonAbort.config(state=DISABLED)
+ 
+         self.info_execution = StringVar()
+         labelExecuting = Label(self, textvariable=self.info_execution, anchor="w")
+-        labelExecuting.grid(column=0, row=11, sticky='EW')
++        labelExecuting.grid(column=0, row=12, sticky='EW')
+ 
+         self.resizable(False, False)
++        
++        # TKinker is not thread safe!
++        # See http://stackoverflow.com/questions/22541693/tkinter-and-thread-out-of-stack-space-infinite-loop
++        self.resetButtons = False
++        self.importingFailureMsg = ""
++        def do_every_50_ms(self):
++            if self.resetButtons:
++                self.buttonFinish.config(state=NORMAL)
++                self.buttonAbort.config(state=DISABLED)
++                self.resetButtons = False
++            if self.importingFailureMsg:
++                tkMessageBox.showerror("Importing GIT repository failed:", 
++                                       self.importingFailureMsg)
++                self.importingFailureMsg = ""
++            self.after(50, do_every_50_ms, self)
++        do_every_50_ms(self)
+ 
+     def search_for_directory(self):
+         dir = askdirectory(parent=self, title='Choose a directory')
+@@ -163,22 +188,29 @@ class Git2DB_GUI(Tk):
+             self.REPO_NAME = self.repoNameVariable.get()
+             self.REPO_OWNER = self.repoOwnerVariable.get()
+             self.BEFORE_DATE = None
++            self.BRANCH = self.branchVariable.get()
++            print("Only branch='" + self.BRANCH + "'")
+             if self.beforeDateVariable.get() != '':
+                 self.BEFORE_DATE = self.beforeDateVariable.get()
+-            schema = self.REPO_OWNER + "_" + self.REPO_NAME
++            schema = self.REPO_NAME
++            if self.REPO_OWNER:
++                schema = self.REPO_OWNER + "_" + self.REPO_NAME
+             self.IMPORT_TYPE = self.importProcessTypeVariable.get()
+             g = Gitana(schema)
+             g.init_dbschema(schema)
+-            g.git2db(schema, self.REPO_PATH, self.BEFORE_DATE, self.IMPORT_TYPE)
++            g.git2db(schema, self.REPO_PATH, self.BEFORE_DATE, self.IMPORT_TYPE, self.BRANCH)
+ 
+             self.info_execution.set("Finished")
+-            self.buttonFinish.config(state=NORMAL)
+-            self.buttonAbort.config(state=DISABLED)
++            #self.buttonFinish.config(state=NORMAL)
++            #self.buttonAbort.config(state=DISABLED)
++            self.resetButtons = True
+         except:
+-            print traceback.format_exc()
++            print (traceback.format_exc())
+             self.info_execution.set("Failed")
+-            self.buttonFinish.config(state=NORMAL)
+-            self.buttonAbort.config(state=DISABLED)
++            #self.buttonFinish.config(state=NORMAL)
++            #self.buttonAbort.config(state=DISABLED)
++            self.importingFailureMsg = traceback.format_exc(limit=1)
++            self.resetButtons = True
+ 
+     def start_export(self):
+         label = Label(self, text=id)

diff --git a/dev-python/gitana/files/0.2/gitana.py.patch b/dev-python/gitana/files/0.2/gitana.py.patch
new file mode 100644
index 000000000..66fec6836
--- /dev/null
+++ b/dev-python/gitana/files/0.2/gitana.py.patch
@@ -0,0 +1,22 @@
+diff --git a/gitana.py b/gitana.py
+index ffbf7c0..c9351fc 100644
+--- a/gitana.py
++++ b/gitana.py
+@@ -29,8 +29,8 @@ class Gitana():
+         i.execute()
+         return
+ 
+-    def git2db(self, db_name, git_path, before, import_type):
+-        extractor = Git2Db(db_name, git_path, before, None, import_type, self.logger)
++    def git2db(self, db_name, git_path, before, import_type, branch):
++        extractor = Git2Db(db_name, git_path, before, None, import_type, self.logger, branch)
+         extractor.extract()
+         return
+ 
+@@ -52,4 +52,4 @@ class Gitana():
+     def updatedb(self, db_name, git_path, before_date, import_last_commit):
+         updater = UpdateDb(db_name, git_path, before_date, import_last_commit, self.logger)
+         updater.update()
+-        return
+\ No newline at end of file
++        return

diff --git a/dev-python/gitana/files/0.2/gitana_gui.py.patch b/dev-python/gitana/files/0.2/gitana_gui.py.patch
new file mode 100644
index 000000000..3cdf87643
--- /dev/null
+++ b/dev-python/gitana/files/0.2/gitana_gui.py.patch
@@ -0,0 +1,53 @@
+diff --git a/gitana_gui.py b/gitana_gui.py
+index 620f3a8..445544d 100644
+--- a/gitana_gui.py
++++ b/gitana_gui.py
+@@ -1,21 +1,25 @@
++#!/usr/bin/python2.7
+ __author__ = 'atlanmod'
+ 
+ from Tkinter import *
+ from PIL import ImageTk, Image
+ import subprocess
++import os
+ 
+ 
+ class GUI(Tk):
++    mypath = ""
+ 
+     def __init__(self):
+         Tk.__init__(self)
++        self.mypath = os.path.dirname(os.path.abspath(__file__)) + "/"
+ 
+         self.initialize()
+         self.title("Gitana")
+         self.mainloop()
+ 
+     def initialize(self):
+-        img = ImageTk.PhotoImage(Image.open("img/gitana_icon.png"))
++        img = ImageTk.PhotoImage(Image.open(self.mypath + "img/gitana_icon.png"))
+         labelImg = Label(image=img)
+         labelImg.image = img
+         labelImg.grid(row=2, columnspan=3, rowspan=10, sticky='WE')
+@@ -37,15 +41,18 @@ class GUI(Tk):
+         self.resizable(False, False)
+ 
+     def start_import(self):
+-        proc = subprocess.Popen({sys.executable, "git2db_gui.py"})
++        cmd = sys.executable + " " + self.mypath + "git2db_gui.py"       
++        proc = subprocess.Popen({cmd}, shell=True)
+         proc.communicate()
+ 
+     def start_update(self):
+-        proc = subprocess.Popen({sys.executable, "updatedb_gui.py"})
++        cmd = sys.executable + " " + self.mypath + "updatedb_gui.py"
++        proc = subprocess.Popen({cmd}, shell=True)
+         proc.communicate()
+ 
+     def start_export(self):
+-        proc = subprocess.Popen({sys.executable, "db2json_gui.py"})
++        cmd = sys.executable + " " + self.mypath + "db2json_gui.py"
++        proc = subprocess.Popen({cmd}, shell=True)
+         proc.communicate()
+ 
+ 

diff --git a/dev-python/gitana/files/0.2/gitquerier_gitpython.py.patch b/dev-python/gitana/files/0.2/gitquerier_gitpython.py.patch
new file mode 100644
index 000000000..b0a36c3ff
--- /dev/null
+++ b/dev-python/gitana/files/0.2/gitquerier_gitpython.py.patch
@@ -0,0 +1,39 @@
+diff --git a/gitquerier_gitpython.py b/gitquerier_gitpython.py
+index ccbe5da..bfcf557 100644
+--- a/gitquerier_gitpython.py
++++ b/gitquerier_gitpython.py
+@@ -10,8 +10,10 @@ class GitQuerier():
+     #python, java, html, xml, sql, javascript, c, c++, scala, php, ruby, matlab
+     ALLOWED_EXTENSION = ['py', 'java', 'html', 'xml', 'sql', 'js', 'c', 'cpp', 'cc', 'scala', 'php', 'rb', 'm']
+ 
+-    def __init__(self, git_repo_path, logger):
++    def __init__(self, git_repo_path, logger, branch):
+         self.logger = logger
++        self.branch = branch
++        print("GitQuerier: self.branch='" + self.branch + "'")
+         self.repo = Repo(git_repo_path, odbt=GitCmdObjectDB)
+         self.gitt = self.repo.git
+         self.no_treated_extensions = set()
+@@ -164,9 +166,13 @@ class GitQuerier():
+         for ref in self.repo.references:
+             if type(ref) == RemoteReference:
+                 if ref.name != "origin/HEAD":
+-                    references.append((ref.name, 'branch'))
++                    if (not self.branch) or (ref.name == self.branch):
++                        print("references.append('" + ref.name + "'")
++                        references.append((ref.name, 'branch'))
+             elif type(ref) == TagReference:
+-                references.append((ref.name, 'tag'))
++                if (not self.branch) or (ref.name == self.branch):
++                    references.append((ref.name, 'tag'))
++                    print("references.append('" + ref.name + "'")
+             else:
+                 self.logger.warning("Git2Db: " + str(type(ref)) + " not handled in the extractor")
+ 
+@@ -686,4 +692,4 @@ class GitQuerier():
+             if self.line_contains_close_block_comment(line, ext):
+                 block_comment = False
+ 
+-        return block_comment
+\ No newline at end of file
++        return block_comment

diff --git a/dev-python/gitana/files/0.2/init.py b/dev-python/gitana/files/0.2/init.py
new file mode 100644
index 000000000..04d2875c1
--- /dev/null
+++ b/dev-python/gitana/files/0.2/init.py
@@ -0,0 +1 @@
+__author__ = 'valerio cosentino'

diff --git a/dev-python/gitana/files/0.2/init_dbschema.py.patch b/dev-python/gitana/files/0.2/init_dbschema.py.patch
new file mode 100644
index 000000000..eb566ff38
--- /dev/null
+++ b/dev-python/gitana/files/0.2/init_dbschema.py.patch
@@ -0,0 +1,20 @@
+diff --git a/init_dbschema.py b/init_dbschema.py
+index 3429e3f..da87d2c 100644
+--- a/init_dbschema.py
++++ b/init_dbschema.py
+@@ -11,6 +11,7 @@ class InitDbSchema():
+     def __init__(self, db_name, logger):
+         self.logger = logger
+         self.db_name = db_name
++        print("DB-name='" + self.db_name + "'")
+ 
+         self.cnx = mysql.connector.connect(**config_db.CONFIG)
+ 
+@@ -357,6 +358,7 @@ class InitDbSchema():
+             RETURN _result;
+         END"""
+ 
++        cursor.execute("SET GLOBAL log_bin_trust_function_creators = 1;")
+         cursor.execute(get_file_history)
+         cursor.execute(levenshtein_distance)
+         cursor.execute(soundex_match)

diff --git a/dev-python/gitana/files/0.2/setup.py b/dev-python/gitana/files/0.2/setup.py
new file mode 100644
index 000000000..2e4ee3bf2
--- /dev/null
+++ b/dev-python/gitana/files/0.2/setup.py
@@ -0,0 +1,39 @@
+#!/usr/bin/python2.7
+
+"""
+	setup module for gitana
+	
+	See:
+	https://github.com/SOM-Research/Gitana/tree/0.2
+	
+	https://packaging.python.org/en/latest/distributing.html
+	https://github.com/pypa/sampleproject
+"""
+
+"""from distutils.core import setup"""
+from setuptools import setup
+
+setup(name='gitana',
+	version='0.2',
+	license='MIT',
+	author='valerio cosentino',
+	url='https://github.com/SOM-Research/Gitana',
+	description='SQL-based Git Repository Inspector',
+	long_description='Gitana exports and digests the data of a Git repository, issue trackers and Q&A web-sites to a relational database in order to ease browsing and querying activities with standard SQL syntax and tools.',
+	keywords='Gitana: SQL-based Git Repository Inspector',
+	packages=['gitana'],
+	package_dir={'gitana': ''},
+	package_data={'gitana': ['img/*.png', 'settings/*']},
+	entry_points = {
+		"console_scripts": [
+			"gitana_gui = gitana.gitana_gui:main",
+		]
+	},
+)
+
+"""py_modules=['foo'],"""
+"""package_data={'mypkg': ['data/*.dat']},"""
+"""data_files=[('img', ['img/*']),
+				('json', ['json/*']),
+				('settings', ['settings/*']),
+			  ],"""

diff --git a/dev-python/gitana/files/0.2/updatedb.py.patch b/dev-python/gitana/files/0.2/updatedb.py.patch
new file mode 100644
index 000000000..b513b143e
--- /dev/null
+++ b/dev-python/gitana/files/0.2/updatedb.py.patch
@@ -0,0 +1,29 @@
+diff --git a/updatedb.py b/updatedb.py
+index adda156..5ea592c 100644
+--- a/updatedb.py
++++ b/updatedb.py
+@@ -17,7 +17,7 @@ class UpdateDb():
+         self.before_date = before_date
+         self.import_last_commit = import_last_commit
+         self.existing_refs = []
+-        self.querier = GitQuerier(git_repo_path, logger)
++        self.querier = GitQuerier(git_repo_path, logger, '')
+ 
+         self.cnx = mysql.connector.connect(**config_db.CONFIG)
+         self.set_database()
+@@ -161,7 +161,7 @@ class UpdateDb():
+             self.delete_file_modifications(last_commit_id)
+ 
+     def update_repo(self, repo_id, import_type):
+-        git2db = Git2Db(self.db_name, self.git_repo_path, self.before_date, self.import_last_commit, import_type, self.logger)
++        git2db = Git2Db(self.db_name, self.git_repo_path, self.before_date, self.import_last_commit, import_type, self.logger, '')
+ 
+         if self.import_last_commit:
+             self.delete_last_commit_info(repo_id)
+@@ -228,4 +228,4 @@ class UpdateDb():
+         minutes_and_seconds = divmod((end_time-start_time).total_seconds(), 60)
+         self.logger.info("UpdateDb: process finished after " + str(minutes_and_seconds[0])
+                      + " minutes and " + str(round(minutes_and_seconds[1], 1)) + " secs")
+-        return
+\ No newline at end of file
++        return

diff --git a/dev-python/gitana/files/0.2/updatedb_gui.py.patch b/dev-python/gitana/files/0.2/updatedb_gui.py.patch
new file mode 100644
index 000000000..c910a9df0
--- /dev/null
+++ b/dev-python/gitana/files/0.2/updatedb_gui.py.patch
@@ -0,0 +1,64 @@
+diff --git a/updatedb_gui.py b/updatedb_gui.py
+index e3c94c6..b89ba4d 100644
+--- a/updatedb_gui.py
++++ b/updatedb_gui.py
+@@ -2,6 +2,7 @@ __author__ = 'atlanmod'
+ 
+ from Tkinter import *
+ from tkFileDialog import *
++import tkMessageBox
+ import threading
+ import os
+ import re
+@@ -76,6 +77,22 @@ class UpdateDB_GUI(Tk):
+         labelExecuting.grid(column=0, row=7, sticky='EW')
+ 
+         self.resizable(False, False)
++        
++        # TKinker is not thread safe!
++        # See http://stackoverflow.com/questions/22541693/tkinter-and-thread-out-of-stack-space-infinite-loop
++        self.resetButtons = False
++        self.importingFailureMsg = ""
++        def do_every_50_ms(self):
++            if self.resetButtons:
++                self.buttonFinish.config(state=NORMAL)
++                self.buttonAbort.config(state=DISABLED)
++                self.resetButtons = False
++            if self.importingFailureMsg:
++                tkMessageBox.showerror("Importing GIT repository failed:", 
++                                       self.importingFailureMsg)
++                self.importingFailureMsg = ""
++            self.after(50, do_every_50_ms, self)
++        do_every_50_ms(self)
+ 
+     def search_for_directory(self):
+         dir = askdirectory(parent=self, title='Choose a directory')
+@@ -141,19 +158,23 @@ class UpdateDB_GUI(Tk):
+         try:
+             self.REPO_PATH = self.repoPathVariable.get()
+             self.DBNAME = self.DBNameVariable.get()
++            print("DB_NAME='" + self.DBNAME + "'")
+             self.BEFORE_DATE = self.beforeDateVariable.get()
+             self.IMPORT_LAST_COMMIT = self.lastCommitCorruptedVariable.get()
+             g = Gitana(self.DBNAME)
+             g.updatedb(self.DBNAME, self.REPO_PATH, self.BEFORE_DATE, self.IMPORT_LAST_COMMIT)
+ 
+             self.info_execution.set("Finished")
+-            self.buttonFinish.config(state=NORMAL)
+-            self.buttonAbort.config(state=DISABLED)
++            #self.buttonFinish.config(state=NORMAL)
++            #self.buttonAbort.config(state=DISABLED)
++            self.resetButtons = True
+         except:
+-            print traceback.format_exc()
++            print( traceback.format_exc())
+             self.info_execution.set("Failed")
+-            self.buttonFinish.config(state=NORMAL)
+-            self.buttonAbort.config(state=DISABLED)
++            #self.buttonFinish.config(state=NORMAL)
++            #self.buttonAbort.config(state=DISABLED)
++            self.importingFailureMsg = traceback.format_exc(limit=1)
++            self.resetButtons = True
+ 
+     def start_export(self):
+         label = Label(self, text=id)

diff --git a/dev-python/gitana/gitana-0.2.ebuild b/dev-python/gitana/gitana-0.2.ebuild
new file mode 100644
index 000000000..77c5b66cf
--- /dev/null
+++ b/dev-python/gitana/gitana-0.2.ebuild
@@ -0,0 +1,76 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PYTHON_COMPAT=( python2_7 )
+PYTHON_REQ_USE="tk"
+
+inherit distutils-r1 eutils
+
+DESCRIPTION="SQL-based Git Repository Inspector"
+HOMEPAGE="https://github.com/SOM-Research/Gitana"
+SRC_URI="https://github.com/SOM-Research/${PN}/archive/${PV}.tar.gz -> ${P}.tar.gz"
+
+LICENSE="MIT"
+SLOT="0"
+IUSE=""
+
+KEYWORDS="~amd64 ~x86"
+
+# problem with https://github.com/SOM-Research/Gitana/issues/5
+# wait for release of git-python version 2.0.9 and update as soon as possible
+
+DEPEND="dev-python/git-python:0[${PYTHON_USEDEP}]
+	dev-python/mysql-connector-python:0[${PYTHON_USEDEP}]
+	dev-python/networkx:0[${PYTHON_USEDEP}]
+	dev-python/pillow:0[tk,${PYTHON_USEDEP}]
+	dev-python/PyGithub:0[${PYTHON_USEDEP}]
+	dev-python/python-bugzilla:0[${PYTHON_USEDEP}]
+	dev-python/simplejson:0[${PYTHON_USEDEP}]
+	>=dev-vcs/git-1.9.4
+	>=virtual/mysql-5.6"
+RDEPEND="${DEPEND}"
+
+S="${WORKDIR}/Gitana-${PV}"
+
+# fixes python compiler issues
+# fixes tk full-qualified import issues
+# fixes path handling
+# adds additional text fields in GUI
+# fixes multi-thread handling
+PATCHES=(
+	"${FILESDIR}/${PV}/case_study.py.patch"
+	"${FILESDIR}/${PV}/db2json_gui.py.patch"
+	"${FILESDIR}/${PV}/git2db.py.patch"
+	"${FILESDIR}/${PV}/git2db_gui.py.patch"
+	"${FILESDIR}/${PV}/gitana.py.patch"
+	"${FILESDIR}/${PV}/gitana_gui.py.patch"
+	"${FILESDIR}/${PV}/gitquerier_gitpython.py.patch"
+	"${FILESDIR}/${PV}/init_dbschema.py.patch"
+	"${FILESDIR}/${PV}/updatedb_gui.py.patch"
+	"${FILESDIR}/${PV}/updatedb.py.patch"
+)
+
+src_prepare() {
+	cp "${FILESDIR}/${PV}/init.py" "${S}/__init__.py" \
+		|| die "Could not copy '${FILESDIR}/${PV}/init__.py' to '${S}/__init.py'"
+	cp "${FILESDIR}/${PV}/setup.py" "${S}/setup.py" \
+		|| die "Could not copy '${FILESDIR}/${PV}/setup.py' to '${S}/setup.py'"
+	# patches are applied by distutils-r1.eclass
+	distutils-r1_python_prepare_all
+}
+
+python_install() {
+	distutils-r1_python_install
+	# install config file
+	dodir /etc/
+	local MY_SITEDIR=$(python_get_sitedir)
+	local MY_FILE="${MY_SITEDIR}/${PN}/config_db.py"
+	local MY_CONF="/etc/gitana_db.conf"
+	mv "${ED}${MY_FILE}" "${ED}${MY_CONF}" \
+		|| die "Could not move '${ED}${MY_FILE}' to '${ED}${MY_CONF}"
+	dosym "${MY_CONF}" "${MY_FILE}"
+	ewarn "Please edit ${EPREFIX}/etc/gitana_db.conf" \
+		" with settings for your MySQL server."
+}

diff --git a/dev-python/gitana/metadata.xml b/dev-python/gitana/metadata.xml
new file mode 100644
index 000000000..ec9fa9d47
--- /dev/null
+++ b/dev-python/gitana/metadata.xml
@@ -0,0 +1,12 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+	<maintainer type="person">
+		<email>harald.weiner@jku.at</email>
+		<name>Harald Weiner</name>
+	</maintainer>
+	<maintainer type="project">
+		<email>sci@gentoo.org</email>
+		<name>Gentoo Science Project</name>
+	</maintainer>
+</pkgmetadata>


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2017-03-26  8:18 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-26  8:18 [gentoo-commits] proj/sci:master commit in: dev-python/busfactor/, dev-python/busfactor/files/0.2/, dev-python/gitana/, Justin Lecher

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox