1
0
Prechádzať zdrojové kódy

cleanup + verbose build

boyska 7 rokov pred
rodič
commit
1c27cba52e
3 zmenil súbory, kde vykonal 22 pridanie a 14 odobranie
  1. 5 0
      Makefile
  2. 3 2
      README.md
  3. 14 12
      plugins/talks.py

+ 5 - 0
Makefile

@@ -12,6 +12,10 @@ DEBUG ?= 0
 ifeq ($(DEBUG), 1)
 	PELICANOPTS += -D
 endif
+VERBOSE ?= 0
+ifeq ($(VERBOSE), 1)
+	PELICANOPTS += -v
+endif
 
 help:
 	@echo 'Makefile for a pelican Web site                                        '
@@ -25,6 +29,7 @@ help:
 	@echo '   make devserver [PORT=8000]       start/restart develop_server.sh    '
 	@echo '   make stopserver                  stop local server                  '
 	@echo '                                                                       '
+	@echo 'Set the VERBOSE variable to 1 for some more messages, e.g. make VERBOSE=1 html'
 	@echo 'Set the DEBUG variable to 1 to enable debugging, e.g. make DEBUG=1 html'
 	@echo '                                                                       '
 

+ 3 - 2
README.md

@@ -20,14 +20,15 @@ Also, `make help` is your friend.
 
 **Morte ai nemici dell'UTF-8**
 
+Se devi debuggare, `make DEBUG=1 publish`
+
 Aggiungere un talk
 --------------------
 
-```sh
+```
 cp -r talks/_talk_example/ talks/MIOTALK/
 vim talks/MIOTALK/meta.yaml
 ```
 
 Quindi rifai `make publish` come spiegato prima: l'output ti informa di eventuali errori nei campi o
 sovrapposizioni con altri talk, leggilo!
-

+ 14 - 12
plugins/talks.py

@@ -98,7 +98,7 @@ def get_talk_data(talkname):
     with io.open(fname, encoding='utf8') as buf:
         try:
             data = yaml.load(buf)
-        except Exception as exc:
+        except:
             logging.exception("Syntax error reading %s; skipping", fname)
             return None
     if data is None:
@@ -134,15 +134,16 @@ def get_talk_data(talkname):
             if 'day' in data:
                 del data['day']
         if 'day' in data:
-            data['day'] = get_global_data()['startdate'] + datetime.timedelta(days=data['day'])
+            data['day'] = get_global_data()['startdate'] + \
+                    datetime.timedelta(days=data['day'])
         if 'time' in data and 'day' in data:
             timeparts = re.findall(r'\d+', str(data['time']))
             if 4 > len(timeparts) > 0:
                 timeparts = [int(p) for p in timeparts]
-                data['time'] = datetime.datetime.combine(data['day'],
-                                                         datetime.time(*timeparts))
+                data['time'] = datetime.datetime.combine(
+                    data['day'], datetime.time(*timeparts))
             else:
-                logging.error("Talk <{}> has malformed `time`".format(talkname))
+                logging.error("Talk <%s> has malformed `time`", talkname)
         data['id'] = talkname
         resdir = os.path.join(TALKS_PATH, talkname, TALK_ATTACHMENT_PATH)
         if os.path.isdir(resdir) and os.listdir(resdir):
@@ -251,16 +252,16 @@ class TalkGridDirective(Directive):
                     times[position + i*GRID_STEP][roomnum] = copy(talk)
                     times[position + i*GRID_STEP][roomnum]['skip'] = True
 
-            #with setlocale(locale.normalize(lang)):
             render = tmpl.render(times=times,
                                  rooms=rooms,
                                  mintime=mintime, maxtime=maxtime,
                                  timestep=GRID_STEP,
                                  lang=lang,
                                  )
-            output.append(nodes.raw('', u'<h4>%s</h4>' %
-                                    format_date(day, format='full', locale=lang),
-                                    format='html'))
+            output.append(nodes.raw(
+                '', u'<h4>%s</h4>' % format_date(day, format='full',
+                                                 locale=lang),
+                format='html'))
             output.append(nodes.raw('', render, format='html'))
         return output
 
@@ -280,17 +281,18 @@ def talk_to_ics(talk):
     if 'time' not in talk or 'duration' not in talk or 'room' not in talk:
         return ''
     start = talk['time']
-    end  = start + datetime.timedelta(minutes=talk['duration'])
+    end = start + datetime.timedelta(minutes=talk['duration'])
     content = 'BEGIN:VEVENT\n'
     content += "UID:%s@%d.hackmeeting.org\n" % (talk['id'], talk['day'].year)
     content += "SUMMARY:%s\n" % talk['title']
     content += "DTSTAMP:%s\n" % time.strftime('%Y%m%dT%H%M%SZ',
-                                              time.gmtime(float(start.strftime('%s'))))
+                                              time.gmtime(float(
+                                                  start.strftime('%s'))))
     content += "DTSTART:%s\n" % time.strftime('%Y%m%dT%H%M%SZ',
                                               time.gmtime(float(
                                                   start.strftime('%s'))))
     content += "DTEND:%s\n" % time.strftime('%Y%m%dT%H%M%SZ',
-                                              time.gmtime(float(
+                                            time.gmtime(float(
                                                   end.strftime('%s'))))
     content += "LOCATION:%s\n" % talk['room']
     content += 'END:VEVENT\n'