Skip to content

Commit 6e91e8b

Browse files
committed
fixed release install
1 parent 446c44a commit 6e91e8b

File tree

2 files changed

+189
-146
lines changed

2 files changed

+189
-146
lines changed

PackageDataPacletInstall.m

+66-58
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@
407407
Options[PDpacletBundle]={
408408
"RemovePaths"->{},
409409
"RemovePatterns"->".DS_Store",
410-
"BuildRoot":>$TemporaryDirectory,
410+
"BuildRoot":>$TemporaryDirectory
411411
};
412412
PDpacletBundle[dir:(_String|_File)?DirectoryQ,ops:OptionsPattern[]]:=
413413
With[{PDpacletDir=
@@ -648,67 +648,75 @@
648648

649649

650650
gitPacletPull[loc:(_String|_URL|_File)]:=
651-
If[StringContainsQ[URLParse[loc,"PathString"],"releases"],
652-
Block[{
653-
release=
654-
SelectFirst[
655-
Flatten@{
656-
Import[
657-
ReplacePart[#,{
658-
"Domain"->"api.github.com",
659-
"Path"->
660-
With[{cleanpath=DeleteCases[#["Path"],""]},
661-
If[cleanpath[[1]]==="repos",
662-
cleanpath,
663-
Prepend[cleanpath,"repos"]
651+
If[StringContainsQ[URLParse[loc,"PathString"],"releases"],
652+
Block[{
653+
release=
654+
SelectFirst[
655+
Flatten@{
656+
Import[
657+
URLBuild@
658+
ReplacePart[#,{
659+
"Domain"->"api.github.com",
660+
"Path"->
661+
With[{cleanpath=DeleteCases[#["Path"],""]},
662+
If[cleanpath[[1]]==="repos",
663+
cleanpath,
664+
Prepend[cleanpath,"repos"]
665+
]
664666
]
665-
]
666-
}]&@URLParse[loc],
667-
"RawJSON"]},
668-
KeyMemberQ["assets"]||KeyMemberQ["zipball_url"]
669-
]
670-
},
671-
If[AssociationQ@release,
672-
If[KeyMemberQ[release,"assets"]&&Length@release["assets"]>0,
673-
With[{url=
674-
release[["assets",-1,"browser_download_url"]]
675-
},
676-
URLDownload[url,
677-
FileNameJoin@{
678-
$TemporaryDirectory,
679-
URLParse[url,"Path"][[-1]]
680-
}
667+
}]&@URLParse[loc],
668+
"RawJSON"]},
669+
KeyMemberQ[#,"assets"]||KeyMemberQ[#,"zipball_url"]&&
670+
(#["prerelease"]=!=True)&
671+
]
672+
},
673+
If[AssociationQ@release,
674+
With[{tmp=CreateDirectory[]},
675+
First@MinimalBy[FileNameDepth]@Select[DirectoryQ]@
676+
If[KeyMemberQ[release,"assets"]&&Length@release["assets"]>0,
677+
With[{url=
678+
release[["assets",-1,"browser_download_url"]]
679+
},
680+
ExtractArchive[
681+
URLDownload[url,
682+
FileNameJoin@{
683+
$TemporaryDirectory,
684+
URLParse[url,"Path"][[-1]]
685+
}
686+
],
687+
tmp
688+
]
689+
],
690+
ExtractArchive[
691+
URLDownload[
692+
release["zipball_url"],
693+
FileNameJoin@{
694+
$TemporaryDirectory,
695+
URLParse[release["zipball_url"],"Path"][[-1]]
696+
}
697+
],
698+
tmp
699+
]
681700
]
682701
],
683-
ExtractArchive[
684-
URLDownload[
685-
release["zipball_url"],
686-
FileNameJoin@{
687-
$TemporaryDirectory,
688-
URLParse[release["zipball_url"],"Path"][[-1]]
689-
}
690-
],
691-
$TemporaryDirectory
692-
]
693-
],
694-
$Failed
702+
$Failed
703+
]
704+
],
705+
With[{
706+
dir=
707+
FileNameJoin@{
708+
$TemporaryDirectory,
709+
DeleteCases[URLParse[loc,"Path"],""][[2]]
710+
}
711+
},
712+
Quiet[
713+
DeleteDirectory[dir,DeleteContents->True];
714+
CreateDirectory[dir]
715+
];
716+
RunProcess[{"git","clone",loc,dir}];
717+
dir
695718
]
696-
],
697-
With[{
698-
dir=
699-
FileNameJoin@{
700-
$TemporaryDirectory,
701-
DeleteCases[URLParse[loc,"Path"],""][[2]]
702-
}
703-
},
704-
Quiet[
705-
DeleteDirectory[dir,DeleteContents->True];
706-
CreateDirectory[dir]
707-
];
708-
RunProcess[{"git","clone",loc,dir}];
709-
dir
710-
]
711-
];
719+
];
712720

713721

714722
wolframLibraryPull[loc:_String|_URL]:=

0 commit comments

Comments
 (0)