#11 Add a switch to do a local checkout of po4a
Merged 4 years ago by jibecfed. Opened 4 years ago by misc.
fedora-docs/ misc/translations-scripts add_local_clone  into  master

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

  l10n/

  sources/

+ po4a/

  translated-sources/

  errors.txt

file modified
+21
@@ -26,6 +26,10 @@ 

                          help="Should we commit translated sources?")

      parser.add_argument("--component", required=False,

                          help="Antora component to convert, all if unset")

+     parser.add_argument("--clone-po4a", action='store_true',

+                         help="Use a local checkout of po4a")

+     parser.add_argument("--clone-po4a-version", default='v0.57',

+                         help="Set the version for checkout of po4a")

      args = parser.parse_args()

  

      SELECTED_COMPONENT = args.component
@@ -39,6 +43,9 @@ 

  

      open("errors.txt", "w").close()

  

+     if args.clone_po4a:

+         clone_po4a(args.clone_po4a_version)

+ 

      if args.clone_sources == "true":

          clone_sources()

  
@@ -51,6 +58,20 @@ 

      if args.commit_tsources == "true":

          commit_translated_source()

  

+ 

+ def clone_po4a(version):

+     """Clone po4a, since the one in RHEL 7 is too old"""

+     print("Clone po4a version %s" % version)

+     repo_dir = '%s/po4a' % os.getcwd()

+ 

+     if os.path.exists(repo_dir):

+         subprocess.run(['git', 'fetch'], check=True, cwd=repo_dir)

+     else:

+         subprocess.run(["git", "clone", "https://github.com/mquinson/po4a" ], check=True)

+     subprocess.run(['git', 'checkout', version], check=True, cwd=repo_dir)

+     os.environ['PATH'] = "%s/:%s" % (repo_dir, os.environ['PATH'])

+     os.environ['PERL5LIB'] = repo_dir + '/lib'

+ 

  def call_src_to_pot(url, branch='master', basedir='/', module="ROOT"):

      """Call src-to-ot.sh to convert english source (adoc) content to pot files"""

      print("call_src_to_pot: "+url +" b:"+ branch +" bd:"+ basedir +" m:"+ module)

Since EL7 do not have a recent enough po4a, we need that
so we can build the pot file on sundries. Once this move to
a newer platform, this code can be removed.

thank you, but I don't like the idea to use master branch of po4a, I'd like to use either a tarbar release or a clone with a specific build so I know it won't change by magic over time

would you like to change it yourself?

please rename it to: --clone-po4a with example value to v0.57

rebased onto 53330f0

4 years ago

thank you very much misc!

Pull-Request has been merged by jibecfed

4 years ago
Metadata