Explorar el Código

Search '/usr/share/gitstats/' for static files as well.

The first path to be searched is the directory of the binary, then
/usr/share/gitstats/. This is so that you can have both a "global" gitstats
version and a user-specific checkout installed, and the static files should be
taken from the matching place.

This change is done in preparation for Debian packaging.

Vincent Fourmond <fourmond@debian.org> is planning to package gitstats for
debian (RFP #440392).
Heikki Hokkanen hace 16 años
padre
commit
6397a94b30
Se han modificado 1 ficheros con 8 adiciones y 2 borrados
  1. 8
    2
      gitstats

+ 8
- 2
gitstats Ver fichero

@@ -478,9 +478,15 @@ class HTMLReportCreator(ReportCreator):
478 478
 		self.title = data.projectname
479 479
 
480 480
 		# copy static files if they do not exist
481
+		basedirs = [os.path.dirname(os.path.abspath(__file__)), '/usr/share/gitstats']
481 482
 		for file in ('gitstats.css', 'sortable.js', 'arrow-up.gif', 'arrow-down.gif', 'arrow-none.gif'):
482
-			basedir = os.path.dirname(os.path.abspath(__file__))
483
-			shutil.copyfile(basedir + '/' + file, path + '/' + file)
483
+			for base in basedirs:
484
+				src = base + '/' + file
485
+				if os.path.exists(src):
486
+					shutil.copyfile(src, path + '/' + file)
487
+					break
488
+			else:
489
+				print 'Warning: "%s" not found, so not copied (searched: %s)' % (file, basedirs)
484 490
 
485 491
 		f = open(path + "/index.html", 'w')
486 492
 		format = '%Y-%m-%d %H:%M:%S'