Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision c09eb68d

Von Moritz Bunkus vor etwa 12 Jahren hinzugefügt

  • ID c09eb68d9142eab98d2815fa73435bdf1c45aedc
  • Vorgänger 11d7c545
  • Nachfolger 1725e45a

Python-Interpreter und -Modulpfad über Konfigurationsoptionen in kivitendo.conf konfigurierbar gemacht

Behebt #671.

Unterschiede anzeigen:

SL/Template/OpenDocument.pm
416 416
  return $display;
417 417
}
418 418

  
419
sub _run_python_uno {
420
  my ($self, @args) = @_;
421

  
422
  local $ENV{PYTHONPATH};
423
  $ENV{PYTHONPATH} = $::lx_office_conf{environment}->{python_uno_path} . ':' . $ENV{PYTHONPATH} if $::lx_office_conf{environment}->{python_uno_path};
424
  my $cmd          = $::lx_office_conf{applications}->{python_uno} . ' ' . join(' ', @args);
425
  return `$cmd`;
426
}
427

  
419 428
sub is_openoffice_running {
429
  my ($self) = @_;
430

  
420 431
  $main::lxdebug->enter_sub();
421 432

  
422
  my $cmd    = "./scripts/oo-uno-test-conn.py " . $::lx_office_conf{print_templates}->{openofficeorg_daemon_port} . " 2> /dev/null";
423
  my $output = `$cmd`;
433
  my $output = $self->_run_python_uno('./scripts/oo-uno-test-conn.py', $::lx_office_conf{print_templates}->{openofficeorg_daemon_port}, ' 2> /dev/null');
424 434
  chomp $output;
425 435

  
426 436
  my $res = ($? == 0) || $output;
......
508 518
    return 0;
509 519
  }
510 520

  
511
  my @cmdline;
512 521
  if (!$::lx_office_conf{print_templates}->{openofficeorg_daemon}) {
513
    @cmdline = ($::lx_office_conf{applications}->{openofficeorg_writer},
514
                "-minimized", "-norestore", "-nologo", "-nolockcheck",
515
                "-headless",
516
                "file:${filename}.odt",
517
                "macro://" . (split('/', $filename))[-1] .
518
                "/Standard.Conversion.ConvertSelfToPDF()");
522
    system($::lx_office_conf{applications}->{openofficeorg_writer},
523
           "-minimized", "-norestore", "-nologo", "-nolockcheck", "-headless",
524
           "file:${filename}.odt",
525
           "macro://" . (split('/', $filename))[-1] . "/Standard.Conversion.ConvertSelfToPDF()");
519 526
  } else {
520 527
    if (!$self->spawn_openoffice()) {
521 528
      $main::lxdebug->leave_sub();
522 529
      return 0;
523 530
    }
524 531

  
525
    @cmdline = ("./scripts/oo-uno-convert-pdf.py",
526
                $::lx_office_conf{print_templates}->{openofficeorg_daemon_port},
527
                "${filename}.odt");
532
    $self->_run_python_uno('./scripts/oo-uno-convert-pdf.py', $::lx_office_conf{print_templates}->{openofficeorg_daemon_port}, "${filename}.odt");
528 533
  }
529 534

  
530
  system(@cmdline);
531

  
532 535
  my $res = $?;
533 536
  if ((0 == $?) || (-f "${filename}.pdf" && -s "${filename}.pdf")) {
534 537
    $form->{"tmpfile"} =~ s/odt$/pdf/;
config/kivitendo.conf.default
127 127
ghostscript = gs
128 128
# Location of the pdflatex (or compatible, e.g. xetex) binary
129 129
latex = pdflatex
130
# Location of the Python interpreter to use when converting from
131
# OpenDocument to PDF. Some distributions compile UNO support only
132
# into binaries located in different locations than the main Python
133
# binary.
134
python_uno = python
130 135
# Location of the two executables "pg_dump" and "pg_restore" used for
131 136
# database backup and restoration from the admin section.  If
132 137
# "pg_dump" or "pg_restore" is set to "DISABLED" then the
......
141 146
# Add the following paths to the PERL5LIB environment variable.
142 147
# "/sw/lib/perl5" is for Mac OS X with Fink's Perl.
143 148
lib = /sw/lib/perl5
149
# Add the following paths to the PYTHONPATH environment variable for
150
# locating Python modules. Python is used when converting OpenDocument
151
# files into PDF files.
152
python_uno_path =
144 153

  
145 154
[print_templates]
146 155
# If you have LaTeX installed set to 1

Auch abrufbar als: Unified diff