wums 0.1.3__tar.gz → 0.1.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: wums
3
- Version: 0.1.3
3
+ Version: 0.1.4
4
4
  Summary: .
5
5
  Author-email: David Walter <david.walter@cern.ch>, Josh Bendavid <josh.bendavid@cern.ch>, Kenneth Long <kenneth.long@cern.ch>
6
6
  License: MIT
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "wums"
7
- version = "0.1.3"
7
+ version = "0.1.4"
8
8
  description = "."
9
9
  readme = { file = "README.md", content-type = "text/markdown" }
10
10
  license = { text = "MIT" }
@@ -36,3 +36,6 @@ dependencies = [
36
36
 
37
37
  [tool.setuptools.packages.find]
38
38
  where = ["."]
39
+
40
+ [tool.setuptools.package-data]
41
+ "wums" = ["Templates/index.php"]
@@ -0,0 +1,131 @@
1
+ <html>
2
+ <head>
3
+ <title><?php echo getcwd(); ?></title>
4
+ <style type='text/css'>
5
+ body {
6
+ font-family: "Candara", sans-serif;
7
+ font-size: 9pt;
8
+ line-height: 10.5pt;
9
+ }
10
+ div.pic h3 {
11
+ font-size: 11pt;
12
+ margin: 0.5em 1em 0.2em 1em;
13
+ }
14
+ div.pic p {
15
+ font-size: 11pt;
16
+ margin: 0.2em 1em 0.1em 1em;
17
+ }
18
+ div.pic {
19
+ display: block;
20
+ float: left;
21
+ background-color: white;
22
+ border: 1px solid #ccc;
23
+ padding: 2px;
24
+ text-align: center;
25
+ margin: 2px 10px 10px 2px;
26
+ -moz-box-shadow: 7px 5px 5px rgb(80,80,80); /* Firefox 3.5 */
27
+ -webkit-box-shadow: 7px 5px 5px rgb(80,80,80); /* Chrome, Safari */
28
+ box-shadow: 7px 5px 5px rgb(80,80,80); /* New browsers */
29
+ width: 320px;
30
+ }
31
+ a { text-decoration: none; color: rgb(80,0,0); }
32
+ a:hover { text-decoration: underline; color: rgb(255,80,80); }
33
+ div.dirlinks h2 { margin-bottom: 4pt; margin-left: -24pt; color: rgb(80,0,0); }
34
+ div.dirlinks { margin: 0 24pt; }
35
+ div.dirlinks a {
36
+ font-size: 11pt; font-weight: bold;
37
+ padding: 0 0.5em;
38
+ }
39
+ </style>
40
+ </head>
41
+ <body>
42
+ <h1><?php echo getcwd(); ?></h1>
43
+ <?php
44
+ $has_subs = true;
45
+ foreach (glob("*") as $filename) {
46
+ if (is_dir($filename) && !preg_match("/^\..*|.*private.*/", $filename)) {
47
+ $has_subs = true;
48
+ break;
49
+ }
50
+ }
51
+ if ($has_subs) {
52
+ print "<div class=\"dirlinks\">\n";
53
+ print "<h2>Directories</h2>\n";
54
+ print "<a href=\"../\">[parent]</a> ";
55
+ foreach (glob("*") as $filename) {
56
+ if (is_dir($filename) && ($_SERVER['PHP_AUTH_USER'] == 'gpetrucc' || !preg_match("/^\..*|.*private.*/", $filename))) {
57
+ print " <a href=\"$filename\">[$filename]</a>";
58
+ }
59
+ }
60
+ print "</div>";
61
+ }
62
+
63
+ foreach (array("00_README.txt", "README.txt", "readme.txt") as $readme) {
64
+ if (file_exists($readme)) {
65
+ print "<pre class='readme'>\n"; readfile($readme); print "</pre>";
66
+ }
67
+ }
68
+ ?>
69
+
70
+ <h2><a name="plots">Plots</a></h2>
71
+ <p><form>Filter: <input type="text" name="match" size="30" value="<?php if (isset($_GET['match'])) print htmlspecialchars($_GET['match']); ?>" /><input type="Submit" value="Go" /><input type="checkbox" name="regexp" <?php if ($_GET['regexp']) print "checked=\"checked\""?> >RegExp</input></form></p>
72
+ <div>
73
+ <?php
74
+ $displayed = array();
75
+ if ($_GET['noplots']) {
76
+ print "Plots will not be displayed.\n";
77
+ } else {
78
+ $other_exts = array('.pdf', '.cxx', '.eps', '.root', '.txt', '.log', '.dir', '.info', '.latex', '.html');
79
+ $filenames = glob("*.png"); sort($filenames);
80
+ foreach ($filenames as $filename) {
81
+ if (isset($_GET['match'])) {
82
+ if (isset($_GET['regexp']) && $_GET['regexp']) {
83
+ if (!preg_match('/.*'.$_GET['match'].'.*/', $filename)) continue;
84
+ } else {
85
+ if (!fnmatch('*'.$_GET['match'].'*', $filename)) continue;
86
+ }
87
+ }
88
+ array_push($displayed, $filename);
89
+ $brfname = str_replace("_","_&shy;",$filename);
90
+ print "<div class='pic'>\n";
91
+ print "<h3><a href=\"$filename\">$brfname</a></h3>";
92
+ print "<a href=\"$filename\"><img src=\"$filename\" style=\"border: none; width: 300px; \"></a>";
93
+ $others = array();
94
+ foreach ($other_exts as $ex) {
95
+ $other_filename = str_replace('.png', $ex, $filename);
96
+ if (file_exists($other_filename)) {
97
+ array_push($others, "<a class=\"file\" href=\"$other_filename\">[" . $ex . "]</a>");
98
+ if ($ex != '.txt') array_push($displayed, $other_filename);
99
+ }
100
+ }
101
+ if ($others) print "<p>Also as ".implode(', ',$others)."</p>";
102
+ print "</div>";
103
+ }
104
+ }
105
+ ?>
106
+ </div>
107
+ <div style="display: block; clear:both;">
108
+ <h2><a name="files">Other files</a></h2>
109
+ <ul>
110
+ <?php
111
+ foreach (glob("*") as $filename) {
112
+ if ($_GET['noplots'] || !in_array($filename, $displayed)) {
113
+ if (isset($_GET['match'])) {
114
+ if (isset($_GET['regexp']) && $_GET['regexp']) {
115
+ if (!preg_match('/.*'.$_GET['match'].'.*/', $filename)) continue;
116
+ } else {
117
+ if (!fnmatch('*'.$_GET['match'].'*', $filename)) continue;
118
+ }
119
+ }
120
+ if (is_dir($filename)) {
121
+ print "<li>[DIR] <a href=\"$filename\">$filename</a></li>";
122
+ } else {
123
+ print "<li><a href=\"$filename\">$filename</a></li>";
124
+ }
125
+ }
126
+ }
127
+ ?>
128
+ </ul>
129
+ </div>
130
+ </body>
131
+ </html>
@@ -5,6 +5,7 @@ import pathlib
5
5
  import pickle
6
6
  import re
7
7
  import shutil
8
+ import importlib.resources as pkg_resources
8
9
  import subprocess
9
10
  import sys
10
11
  import tempfile
@@ -185,19 +186,17 @@ def write_logfile(
185
186
  logf.write(f"{k}: {v}\n")
186
187
 
187
188
 
188
- def write_indexfile(
189
- outpath,
190
- template_dir=f"{pathlib.Path(__file__).parent}/../Templates",
191
- indexname = "index.php"
192
- ):
193
- shutil.copyfile(f"{template_dir}/{indexname}", f"{outpath}/index.php")
189
+ def write_indexfile(outpath, template_dir="Templates", indexname="index.php"):
190
+ with pkg_resources.files("wums").joinpath(f"{template_dir}/{indexname}").open("rb") as src:
191
+ with open(f"{outpath}/index.php", "wb") as dst:
192
+ shutil.copyfileobj(src, dst)
194
193
 
195
194
 
196
195
  def write_index_and_log(
197
196
  outpath,
198
197
  logname,
199
- template_dir=f"{pathlib.Path(__file__).parent}/../Templates",
200
- analysis_meta_info=None,
198
+ template_dir="Templates",
199
+ analysis_meta_info={},
201
200
  args={},
202
201
  wd=f"{pathlib.Path(__file__).parent}/../",
203
202
  ):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: wums
3
- Version: 0.1.3
3
+ Version: 0.1.4
4
4
  Summary: .
5
5
  Author-email: David Walter <david.walter@cern.ch>, Josh Bendavid <josh.bendavid@cern.ch>, Kenneth Long <kenneth.long@cern.ch>
6
6
  License: MIT
@@ -10,4 +10,5 @@ wums.egg-info/PKG-INFO
10
10
  wums.egg-info/SOURCES.txt
11
11
  wums.egg-info/dependency_links.txt
12
12
  wums.egg-info/requires.txt
13
- wums.egg-info/top_level.txt
13
+ wums.egg-info/top_level.txt
14
+ wums/Templates/index.php
@@ -1,4 +1,3 @@
1
- Templates
2
1
  dist
3
2
  env
4
3
  wums
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes