Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
lazarus-project / usr / share / lazarus / 2.0.10 / components / fppkg / src / fppkg_lpk.pas
Size: Mime:
unit fppkg_lpk;

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils;

type
  TLPKStatus = (lpDesigntime, lpRuntime, lpBoth);

function LPKStatus(AFileName: string): TLPKStatus;
function LPKFindPackage(PackageName: string): string;

implementation

uses
  XMLConf, fprepos, pkgmessages, pkgglobals, pkgrepos, pkghandler, fileutil;

function LPKStatus(AFileName: string): TLPKStatus;
var
  xml: TXMLConfig;
  pkgtype: string;
begin
  xml := TXMLConfig.Create(nil);

  try
    xml.Filename := AFileName;

    pkgtype := LowerCase(xml.GetValue('Package/Type/Value', ''));

    //default
    Result := lpRunTime;

    if pkgtype = 'designtime' then
      Result := lpDesignTime;
    if pkgtype = 'runanddesigntime' then
      Result := lpBoth;

  finally
    FreeAndNil(xml);
  end;
end;

function LPKFindPackage(PackageName: string): string;
  //this really needs to come through the manifest,
  //what if a package has multiple .lpk files?
  //do we install them all?
  //do we need to add a target to each LPK file?
  //or do we split the package in multiple ones
var
//  BuildDir: string;
//  P: TFPPackage;
  files: TStrings;
begin
  if PackageName = '' then
    pkgglobals.Error(SErrNoPackageSpecified);

{  P := AvailableRepository.PackageByName(PackageName);
  BuildDir := PackageBuildPath(P);
  files := FindAllFiles(BuildDir, '*.lpk');
 }
  if files.Count > 0 then
    Result := files[0]
  else
    Result := '';

  FreeAndNil(files);
end;

end.