#4 test pr ci
Opened 2 years ago by darknao. Modified 2 years ago

file modified
+4 -4
@@ -1,10 +1,10 @@ 

- FROM fedora:30

+ FROM fedora:34

  MAINTAINER Rick Elrod <relrod@redhat.com>

  

  WORKDIR /opt/oldrepo/

  

- RUN  dnf install -y git gettext python-genshi python-lxml python-setuptools \

-      python-dateutil python-dogpile-cache babel python-feedparser fedfind \

-      python-requests python2-babel findutils make httpd

+ RUN  dnf install -y git gettext python3-genshi python3-lxml python3-setuptools \

+      python3-dateutil python3-dogpile-cache babel python3-feedparser fedfind \

+      python3-requests python3-babel python3-langtable findutils make httpd

  

  EXPOSE 5000

file modified
+1 -1
@@ -5,7 +5,7 @@ 

  endif

  HTML_FILES = $(shell find data -name "*.html")

  RESOURCE_NAME = /var/tmp/po_dir

- PYTHON = python2.7

+ PYTHON = python3

  PYBABEL = $(PYTHON) /usr/bin/pybabel

  BASEPATH = /

  PWD = $(shell pwd)

@@ -30,7 +30,7 @@ 

  

  # We cache this guy on disk for 500s

  def collect(release):

-     filename = cachefile % (sha1(str(release)).hexdigest())

+     filename = cachefile % ((sha1(bytes(str(release),encoding="utf8")).hexdigest()))

      shelf = shelve.open(filename)

      check_permissions(filename=filename)

      if shelf.get('timestamp') and shelf.get('timestamp') > (datetime.utcnow() - timedelta(hours=1)):

file modified
+9 -8
@@ -38,7 +38,7 @@ 

  try:

      import globalvar

  except ImportError:

-     print "globalvar.py is missing. It is needed as it provides release specific variables"

+     print ("globalvar.py is missing. It is needed as it provides release specific variables")

      raise

  

  # Import websites specific modules, used to create specific
@@ -134,22 +134,23 @@ 

                  process_dir(dirpath, filenames)

              except:

                  if options.keepgoing:

-                     print 'Error!'

+                     print ('Error!')

                  else:

                      raise

          if HAVE_TIMING:

              timing.finish()

          if not options.rss and HAVE_TIMING:

-             print 'Website build time: %s' % timing.milli()

+             print (f'Website build time: {timing.milli()}')

  

  def process_dir(dirpath, filenames):

      '''

      Process a directory

      '''

      if options.podir and options.lang:

-         translations = GNUTranslations(open(os.path.join(options.podir, options.lang + '.mo')))

+         translations = GNUTranslations(open(os.path.join(options.podir, options.lang + '.mo'),"rb"))

+ 

          if int(get_distribution('genshi').version[2]) < 6:

-             loader = TemplateLoader(['.'], callback=lambda template: template.filters.insert(0, Translator(translations.ugettext)))

+             loader = TemplateLoader(['.'], callback=lambda template: template.filters.insert(0, Translator(translations.gettext)))

          else:

              loader = TemplateLoader(['.'], callback=lambda template: template.filters.insert(0, Translator(translations)))

      for fn in filenames:
@@ -202,7 +203,7 @@ 

                                    'atomic_vagrant_virtualbox', 'atomic_iso']

              with open(os.path.join(options.output, ".htaccess"), 'a') as htaccess_f:

                  for artifact in artifacts_redirect:

-                     if artifact is 'atomic_iso':

+                     if artifact == 'atomic_iso':

                          htaccess_f.write('Redirect 302 "/{}_latest"'

                                           ' "/atomic_dvd_ostree_x86_64_latest"\n'.format(artifact))

                          htaccess_f.write('Redirect 302 "/{}_latest_filename"'
@@ -239,7 +240,7 @@ 

          template = loader.load(src_file)

          # Variables made availble to all templates

          page = template.generate(

-             _=lambda text: translations.ugettext(text),

+             _=lambda text: translations.gettext(text),

              feedparse=feedparse,

              lang=options.lang,

              relpath=relpath,
@@ -249,7 +250,7 @@ 

              schedule = release_date,

              ec2_ami = ec2,

              iot_links = iot_compose_links

-             ).render(method='html', doctype='html', encoding='utf-8')

+             ).render(method='html', doctype='html')

          output = open(dest_file, 'w')

          output.write(page)

          output.close()

file modified
+14 -14
@@ -12,35 +12,35 @@ 

          languages.append((lang, code))

  linguas.close()

  

- print '# Define the correct MIME type for specific languages'

+ print ('# Define the correct MIME type for specific languages')

  for lang in ['bn', 'el', 'nb', 'pl', 'es', 'tr']:

-     print 'AddType text/html .%s' % (lang)

+     print ('AddType text/html .%s' % (lang))

  

- print ' '

+ print (' ')

  

  for (lang, code) in languages:

-     print 'AddLanguage %s .%s' % (code, lang)

+     print ('AddLanguage %s .%s' % (code, lang))

  

- print '''

+ print ('''

  LanguagePriority en

  ForceLanguagePriority Prefer Fallback

  

  AddDefaultCharset utf-8

  

  RewriteEngine on

- '''

+ ''')

  

- lang_regex = '|'.join(zip(*languages)[0])

- print 'RewriteCond %%{QUERY_STRING} ^lang=(%s)$' % lang_regex

- print 'RewriteRule ^(?:/(?:%s))?(/.*)$ /%%1$1? [R=301]' % lang_regex

- print 'AliasMatch ^(?:/(?:%s))(/.*)?$ @DOCUMENTROOT@$1' % lang_regex

+ lang_regex = "|".join(list(zip(*languages))[0])

+ print ('RewriteCond %%{QUERY_STRING} ^lang=(%s)$' % lang_regex)

+ print ('RewriteRule ^(?:/(?:%s))?(/.*)$ /%%1$1? [R=301]' % lang_regex)

+ print ('AliasMatch ^(?:/(?:%s))(/.*)?$ @DOCUMENTROOT@$1' % lang_regex)

  

- print '''

+ print ('''

  <Directory @DOCUMENTROOT@>

    Options MultiViews

- '''

+ ''')

  

  for (lang, code) in languages:

-     print '  SetEnvIf Request_URI ^/%s/ prefer-language=%s' % (lang, code)

+     print ('  SetEnvIf Request_URI ^/%s/ prefer-language=%s' % (lang, code))

  

- print '</Directory>'

+ print ('</Directory>')

@@ -1,6 +1,6 @@ 

  #!/bin/env python

  

- import ConfigParser, sys, os

+ import configparser, sys, os

  import langtable

  

  '''
@@ -8,8 +8,8 @@ 

  It takes as argument the translations.ini relative path, the LINGUAS file relative path, and the output template name

  '''

  

- language_map = ConfigParser.ConfigParser()

- language_map.readfp(open(sys.argv[1]))

+ language_map = configparser.ConfigParser()

+ language_map.read_file(open(sys.argv[1]))

  

  banned = language_map.get('Banned', 'lang_code')

  
@@ -42,7 +42,7 @@ 

                  if lang and not lang.startswith('#') and not lang in banned:

                      #output.write('    <option value="' + lang + '" py:attrs="{\'selected\': lang == \'' + lang + '\' and \'selected\' or None}">' + language_map.get('Languages',lang) + '</option>\n')

                      #output.write(", '"+lang+"': '"+language_map.get('Languages',lang)+"'")

-                     output.write(", '"+lang+"': '"+langtable.language_name(languageId=lang).encode('utf-8')+"'")

+                     output.write(", '"+lang+"': '"+langtable.language_name(languageId=lang)+"'")

          finally:

              linguas.close()

          output.write("""}

@@ -1,5 +1,5 @@ 

  import os

- import cPickle

+ import pickle

  import feedparser

  import socket

  import sys
@@ -10,8 +10,8 @@ 

      feeds = [{}] 

      cachefile = os.path.join(os.getcwd(), 'build/rss.cache')

      if os.path.isfile(cachefile):

-         f = open(cachefile)

-         feeds = cPickle.load(f)

+         f = open(cachefile, 'rb')

+         feeds = pickle.load(f)

          f.close()

  

      # We parse the list
@@ -32,8 +32,8 @@ 

      main_feed = feedparser.parse(url)

      socket.setdefaulttimeout(timeout)

      if len(main_feed['entries']) < 1:

-         print 'ERROR: ' + str(main_feed['bozo_exception'])

-         print 'Could not load ' + url

+         print('ERROR: ' + str(main_feed['bozo_exception']))

+         print('Could not load ' + url)

          sys.exit(1)

      entry = [{}]

      for feed in main_feed["entries"]:
@@ -46,8 +46,8 @@ 

      url_entries.append({'url':url, 'feed':entry})

      feeds.append(url_entries)

  

-     f = open(cachefile, 'w')

-     cPickle.dump(feeds, f)

+     f = open(cachefile, 'wb')

+     pickle.dump(feeds, f)

      f.close()

      feed_url = dict()

      return entry

@@ -1,6 +1,6 @@ 

  <?python

  import os

- available_languages = ', '.join(os.walk('static/images/counter/').next()[1])

+ available_languages = ', '.join(list(os.walk('static/images/counter/'))[0][1])

  ?>

  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

  <html xmlns="http://www.w3.org/1999/xhtml"

@@ -1,5 +1,6 @@ 

  <?python

  # Planet

+ from rss import feedparse

  fpp = feedparse('http://fedoraplanet.org/rss20.xml')

  

  # Announce List

@@ -33,8 +33,8 @@ 

      main_feed = feedparser.parse(url)

      socket.setdefaulttimeout(timeout)

      if len(main_feed['entries']) < 1:

-         print 'ERROR: ' + str(main_feed['bozo_exception'])

-         print 'Could not load ' + url

+         print ('ERROR: ' + str(main_feed['bozo_exception']))

+         print ('Could not load ' + url)

          sys.exit(1)

      entry = [{}]

      for feed in main_feed["entries"]: