diff --git a/SQLinDS/description.sas b/SQLinDS/description.sas index 83e1c10..653ba28 100644 --- a/SQLinDS/description.sas +++ b/SQLinDS/description.sas @@ -1,4 +1,4 @@ -/* This is the description file for the package. */ +/* This is the description file for the package. */ /* The collon (:) is a field separator and is restricted */ /* in lines of the header part. */ @@ -12,7 +12,8 @@ Maintainer: Bartosz Jablonski (yabwon@gmail.com) :/*required, not null*/ License: MIT :/*required, not null, values: MIT, GPL2, BSD, etc.*/ Encoding: UTF8 :/*required, not null, values: UTF8, WLATIN1, LATIN2, etc. */ -Required: "Base SAS Software" :/*optional, COMMA separated, QUOTED list, values must be like from proc setinit;run; output */ +Required: "Base SAS Software" :/*optional, COMMA separated, QUOTED list, names of required SAS products, values must be like from proc setinit;run; output */ +ReqPackages: "macroArray (0.1)", "DFA (0.1)" :/*optional, COMMA separated, QUOTED list, names of required packages */ /* **DESCRIPTION** */ /* All the text below will be used in help */ diff --git a/SQLinDS/generate_package_sqlinds.sas b/SQLinDS/generate_package_sqlinds.sas index 30c15f0..5122c55 100644 --- a/SQLinDS/generate_package_sqlinds.sas +++ b/SQLinDS/generate_package_sqlinds.sas @@ -9,7 +9,7 @@ ods html; * filename reference "packages" and "package" are keywords; * the first one should be used to point folder with packages; * the second is used internaly by macros; - + filename packages "C:\SAS_PACKAGES"; %include packages(loadpackage.sas); diff --git a/generatePackage.sas b/generatePackage.sas index 5d1643a..7b20661 100644 --- a/generatePackage.sas +++ b/generatePackage.sas @@ -80,14 +80,15 @@ filename &_LIC_. "&filesLocation./license.sas" lrecl = 256; input; select; - when(upcase(scan(_INFILE_, 1, ":")) = "PACKAGE") call symputX("packageName", scan(_INFILE_, 2, ":"),"L"); - when(upcase(scan(_INFILE_, 1, ":")) = "VERSION") call symputX("packageVersion", scan(_INFILE_, 2, ":"),"L"); - when(upcase(scan(_INFILE_, 1, ":")) = "AUTHOR") call symputX("packageAuthor", scan(_INFILE_, 2, ":"),"L"); - when(upcase(scan(_INFILE_, 1, ":")) = "MAINTAINER") call symputX("packageMaintainer", scan(_INFILE_, 2, ":"),"L"); - when(upcase(scan(_INFILE_, 1, ":")) = "TITLE") call symputX("packageTitle", scan(_INFILE_, 2, ":"),"L"); - when(upcase(scan(_INFILE_, 1, ":")) = "ENCODING") call symputX("packageEncoding", scan(_INFILE_, 2, ":"),"L"); - when(upcase(scan(_INFILE_, 1, ":")) = "LICENSE") call symputX("packageLicense", scan(_INFILE_, 2, ":"),"L"); - when(upcase(scan(_INFILE_, 1, ":")) = "REQUIRED") call symputX("packageRequired", scan(_INFILE_, 2, ":"),"L"); + when(upcase(scan(_INFILE_, 1, ":")) = "PACKAGE") call symputX("packageName", scan(_INFILE_, 2, ":"),"L"); + when(upcase(scan(_INFILE_, 1, ":")) = "VERSION") call symputX("packageVersion", scan(_INFILE_, 2, ":"),"L"); + when(upcase(scan(_INFILE_, 1, ":")) = "AUTHOR") call symputX("packageAuthor", scan(_INFILE_, 2, ":"),"L"); + when(upcase(scan(_INFILE_, 1, ":")) = "MAINTAINER") call symputX("packageMaintainer", scan(_INFILE_, 2, ":"),"L"); + when(upcase(scan(_INFILE_, 1, ":")) = "TITLE") call symputX("packageTitle", scan(_INFILE_, 2, ":"),"L"); + when(upcase(scan(_INFILE_, 1, ":")) = "ENCODING") call symputX("packageEncoding", scan(_INFILE_, 2, ":"),"L"); + when(upcase(scan(_INFILE_, 1, ":")) = "LICENSE") call symputX("packageLicense", scan(_INFILE_, 2, ":"),"L"); + when(upcase(scan(_INFILE_, 1, ":")) = "REQUIRED") call symputX("packageRequired", scan(_INFILE_, 2, ":"),"L"); + when(upcase(scan(_INFILE_, 1, ":")) = "REQPACKAGES") call symputX("packageReqPackages", scan(_INFILE_, 2, ":"),"L"); /* stop at the begining of description */ when(upcase(scan(_INFILE_, 1, ":")) = "DESCRIPTION START") stop; @@ -150,6 +151,19 @@ filename &_LIC_. "&filesLocation./license.sas" lrecl = 256; %abort; %end; +/* test if version is a number */ +data _null_; + version = input("&packageVersion.", ?? best32.); + if not (version > 0) then + do; + put 'ERROR: Packave version should be a positive NUMBER.'; + put 'ERROR- Current value is: ' "&packageVersion."; + put 'ERROR- Try something small, e.g. 0.1'; + put; + abort; + end; +run; + /* create or replace the ZIP file for package */ filename &zipReferrence. ZIP "&filesLocation./%lowcase(&packageName.).zip"; @@ -426,12 +440,18 @@ data _null_; isFunction = 0; isFormat = 0; - %if %bquote(&packageRequired.) ne %then + %if (%bquote(&packageRequired.) ne ) + or (%bquote(&packageReqPackages.) ne ) + %then %do; put ' data _null_; '; put ' call symputX("packageRequiredErrors", 0, "L"); '; put ' run; '; - put ' %put NOTE- *Testing required SAS components*%sysfunc(dosubl( '; + %end; + + %if %bquote(&packageRequired.) ne %then + %do; + put ' %put NOTE- *Testing required SAS components*%sysfunc(DoSubL( '; /* DoSubL() */ put ' options nonotes nosource %str(;) '; put ' options ls=max ps=max %str(;) '; put ' /* temporary redirect log */ '; @@ -488,6 +508,26 @@ data _null_; put ' filename _stinit_ clear %str(;) '; put ' options notes source %str(;) '; put ' ))*; '; + %end; + + %if %bquote(&packageReqPackages.) ne %then + %do; + /* + put ' data _null_ ; '; + put ' length req $ 64 ; '; + length packageReqPackages $ 32767; + packageReqPackages = lowcase(symget('packageReqPackages')); + put ' do req = ' / packageReqPackages / ' ; '; + put ' call execute(''%nrstr(%loadPackage('' || scan(req,1) || ''));'') ; '; + put ' end ; '; + put 'run; '; + */ + %end; + + %if (%bquote(&packageRequired.) ne ) + or (%bquote(&packageReqPackages.) ne ) + %then + %do; put ' data _null_; '; put ' if symget("packageRequiredErrors") = "1" then '; put ' do; '; diff --git a/sqlinds.zip b/sqlinds.zip index 46f2633..8731461 100644 Binary files a/sqlinds.zip and b/sqlinds.zip differ