#1446 update README.rst, createdb.py, dev-data.py for python3
Merged 7 years ago by pingou. Opened 7 years ago by billauger.
billauger/pagure py3_work  into  py3_work

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

  

  * Install the needed system libraries::

  

-     sudo dnf install git python-virtualenv libgit2-devel \

+     sudo dnf install git python3-virtualenv libgit2-devel \

                       libjpeg-devel gcc libffi-devel redhat-rpm-config

  

    .. note:: Do note the version of libgit2 that you install, for example

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

- #!/usr/bin/env python2

+ #!/usr/bin/env python3

  

  # These two lines are needed to run on EL6

  __requires__ = ['SQLAlchemy >= 0.8', 'jinja2 >= 2.4']

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

- #!/usr/bin/env python

+ #!/usr/bin/env python3

  """ Populate the pagure db with some dev data. """

  import sys

  
@@ -40,7 +40,7 @@ 

      print('WARNING: Deleting all data from ', pagure.APP.config['DB_URL'])

      # Dangerous: this will wipe the data from the table but keep the schema

      print('')

-     response = raw_input('Do you want to continue yes or no?    ')

+     response = input('Do you want to continue yes or no?    ')

      if 'yes'.startswith(response.lower()):

          for tbl in reversed(metadata.sorted_tables):

              if tbl.fullname != 'acls':
@@ -447,22 +447,22 @@ 

          session = pagure.SESSION

          invalid_option = ['pingou', 'bar@pingou.com', 'foo', 'foo@bar.com']

          print("")

-         user_name = raw_input(

+         user_name = input(

              "Enter your username so we can add you into the test data:  ")

          while user_name in invalid_option:

              print("Reserved names: " + str(invalid_option))

-             user_name = raw_input(

+             user_name = input(

                  "Enter your username so we can add you into the test data:  ")

  

          if not user_name.replace(" ", ""):

              user_name = 'pythagoras'

  

          print("")

-         user_email = raw_input("Enter your user email:  ")

+         user_email = input("Enter your user email:  ")

  

          while user_email in invalid_option:

              print("Reserved names: " + str(invalid_option))

-             user_email = raw_input("Enter your user email:  ")

+             user_email = input("Enter your user email:  ")

  

          if not user_email.replace(" ", ""):

              user_email = 'pythagoras@math.com'

a few things i had to change in the setup scripts that were incompatible with a python v3-only system

'raw_input' was renamed to 'input' in python 3

from https://docs.python.org/3/whatsnew/3.0.html

PEP 3111: raw_input() was renamed to input(). That is, the new input() function reads a line from sys.stdin and returns it with the trailing newline stripped. It raises EOFError if the input is terminated prematurely. To get the old behavior of input(), use eval(input()).

Thanks, I had no ported the createdb or dev-data scripts indeed.

Pull-Request has been merged by pingou

7 years ago