diff --git a/bionetgen/assets/BNGVERSION b/bionetgen/assets/BNGVERSION index b7d922a..55f31d8 100644 --- a/bionetgen/assets/BNGVERSION +++ b/bionetgen/assets/BNGVERSION @@ -1 +1 @@ -BioNetGen-2.9.1 +BioNetGen-2.9.1 \ No newline at end of file diff --git a/bionetgen/assets/ghapi.json b/bionetgen/assets/ghapi.json index 40072df..3ff7ef3 100644 --- a/bionetgen/assets/ghapi.json +++ b/bionetgen/assets/ghapi.json @@ -1 +1 @@ -{"url": "https://api.github.com/repos/RuleWorld/bionetgen/releases/113526748", "assets_url": "https://api.github.com/repos/RuleWorld/bionetgen/releases/113526748/assets", "upload_url": "https://uploads.github.com/repos/RuleWorld/bionetgen/releases/113526748/assets{?name,label}", "html_url": "https://github.com/RuleWorld/bionetgen/releases/tag/BioNetGen-2.9.0", "id": 113526748, "author": {"login": "mr2cents", "id": 86616300, "node_id": "MDQ6VXNlcjg2NjE2MzAw", "avatar_url": "https://avatars.githubusercontent.com/u/86616300?v=4", "gravatar_id": "", "url": "https://api.github.com/users/mr2cents", "html_url": "https://github.com/mr2cents", "followers_url": "https://api.github.com/users/mr2cents/followers", "following_url": "https://api.github.com/users/mr2cents/following{/other_user}", "gists_url": "https://api.github.com/users/mr2cents/gists{/gist_id}", "starred_url": "https://api.github.com/users/mr2cents/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/mr2cents/subscriptions", "organizations_url": "https://api.github.com/users/mr2cents/orgs", "repos_url": "https://api.github.com/users/mr2cents/repos", "events_url": "https://api.github.com/users/mr2cents/events{/privacy}", "received_events_url": "https://api.github.com/users/mr2cents/received_events", "type": "User", "site_admin": false}, "node_id": "RE_kwDOAe1CjM4GxEfc", "tag_name": "BioNetGen-2.9.0", "target_commitish": "master", "name": "BioNetGen-2.9.0", "draft": false, "prerelease": false, "created_at": "2023-07-25T16:44:50Z", "published_at": "2023-07-25T17:03:16Z", "assets": [{"url": "https://api.github.com/repos/RuleWorld/bionetgen/releases/assets/118587100", "id": 118587100, "node_id": "RA_kwDOAe1CjM4HEX7c", "name": "BioNetGen-2.9.0-linux.tar.gz", "label": null, "uploader": {"login": "mr2cents", "id": 86616300, "node_id": "MDQ6VXNlcjg2NjE2MzAw", "avatar_url": "https://avatars.githubusercontent.com/u/86616300?v=4", "gravatar_id": "", "url": "https://api.github.com/users/mr2cents", "html_url": "https://github.com/mr2cents", "followers_url": "https://api.github.com/users/mr2cents/followers", "following_url": "https://api.github.com/users/mr2cents/following{/other_user}", "gists_url": "https://api.github.com/users/mr2cents/gists{/gist_id}", "starred_url": "https://api.github.com/users/mr2cents/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/mr2cents/subscriptions", "organizations_url": "https://api.github.com/users/mr2cents/orgs", "repos_url": "https://api.github.com/users/mr2cents/repos", "events_url": "https://api.github.com/users/mr2cents/events{/privacy}", "received_events_url": "https://api.github.com/users/mr2cents/received_events", "type": "User", "site_admin": false}, "content_type": "application/x-gzip", "state": "uploaded", "size": 78233963, "download_count": 2, "created_at": "2023-07-25T17:01:54Z", "updated_at": "2023-07-25T17:02:00Z", "browser_download_url": "https://github.com/RuleWorld/bionetgen/releases/download/BioNetGen-2.9.0/BioNetGen-2.9.0-linux.tar.gz"}, {"url": "https://api.github.com/repos/RuleWorld/bionetgen/releases/assets/118582570", "id": 118582570, "node_id": "RA_kwDOAe1CjM4HEW0q", "name": "BioNetGen-2.9.0-mac.tar.gz", "label": null, "uploader": {"login": "mr2cents", "id": 86616300, "node_id": "MDQ6VXNlcjg2NjE2MzAw", "avatar_url": "https://avatars.githubusercontent.com/u/86616300?v=4", "gravatar_id": "", "url": "https://api.github.com/users/mr2cents", "html_url": "https://github.com/mr2cents", "followers_url": "https://api.github.com/users/mr2cents/followers", "following_url": "https://api.github.com/users/mr2cents/following{/other_user}", "gists_url": "https://api.github.com/users/mr2cents/gists{/gist_id}", "starred_url": "https://api.github.com/users/mr2cents/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/mr2cents/subscriptions", "organizations_url": "https://api.github.com/users/mr2cents/orgs", "repos_url": "https://api.github.com/users/mr2cents/repos", "events_url": "https://api.github.com/users/mr2cents/events{/privacy}", "received_events_url": "https://api.github.com/users/mr2cents/received_events", "type": "User", "site_admin": false}, "content_type": "application/x-gzip", "state": "uploaded", "size": 48595935, "download_count": 0, "created_at": "2023-07-25T16:39:00Z", "updated_at": "2023-07-25T16:39:05Z", "browser_download_url": "https://github.com/RuleWorld/bionetgen/releases/download/BioNetGen-2.9.0/BioNetGen-2.9.0-mac.tar.gz"}, {"url": "https://api.github.com/repos/RuleWorld/bionetgen/releases/assets/118582606", "id": 118582606, "node_id": "RA_kwDOAe1CjM4HEW1O", "name": "BioNetGen-2.9.0-win.tar.gz", "label": null, "uploader": {"login": "mr2cents", "id": 86616300, "node_id": "MDQ6VXNlcjg2NjE2MzAw", "avatar_url": "https://avatars.githubusercontent.com/u/86616300?v=4", "gravatar_id": "", "url": "https://api.github.com/users/mr2cents", "html_url": "https://github.com/mr2cents", "followers_url": "https://api.github.com/users/mr2cents/followers", "following_url": "https://api.github.com/users/mr2cents/following{/other_user}", "gists_url": "https://api.github.com/users/mr2cents/gists{/gist_id}", "starred_url": "https://api.github.com/users/mr2cents/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/mr2cents/subscriptions", "organizations_url": "https://api.github.com/users/mr2cents/orgs", "repos_url": "https://api.github.com/users/mr2cents/repos", "events_url": "https://api.github.com/users/mr2cents/events{/privacy}", "received_events_url": "https://api.github.com/users/mr2cents/received_events", "type": "User", "site_admin": false}, "content_type": "application/x-gzip", "state": "uploaded", "size": 42114907, "download_count": 1, "created_at": "2023-07-25T16:39:16Z", "updated_at": "2023-07-25T16:39:20Z", "browser_download_url": "https://github.com/RuleWorld/bionetgen/releases/download/BioNetGen-2.9.0/BioNetGen-2.9.0-win.tar.gz"}], "tarball_url": "https://api.github.com/repos/RuleWorld/bionetgen/tarball/BioNetGen-2.9.0", "zipball_url": "https://api.github.com/repos/RuleWorld/bionetgen/zipball/BioNetGen-2.9.0", "body": "### Major changes\r\n* Species are exported to a SBML initial assignments block. Constant expressions are also exported in initial assignments block as long as they weren't a part of the original species block. This will improve the functionality of the exported SBML output for downstream tools.\r\n\r\n### Minor changes\r\n* Referring to observables or functions within species will result in an error as it could lead to circular dependency."} \ No newline at end of file +{"url": "https://api.github.com/repos/RuleWorld/bionetgen/releases/143539756", "assets_url": "https://api.github.com/repos/RuleWorld/bionetgen/releases/143539756/assets", "upload_url": "https://uploads.github.com/repos/RuleWorld/bionetgen/releases/143539756/assets{?name,label}", "html_url": "https://github.com/RuleWorld/bionetgen/releases/tag/BioNetGen-2.9.1", "id": 143539756, "author": {"login": "jrfaeder", "id": 8277248, "node_id": "MDQ6VXNlcjgyNzcyNDg=", "avatar_url": "https://avatars.githubusercontent.com/u/8277248?v=4", "gravatar_id": "", "url": "https://api.github.com/users/jrfaeder", "html_url": "https://github.com/jrfaeder", "followers_url": "https://api.github.com/users/jrfaeder/followers", "following_url": "https://api.github.com/users/jrfaeder/following{/other_user}", "gists_url": "https://api.github.com/users/jrfaeder/gists{/gist_id}", "starred_url": "https://api.github.com/users/jrfaeder/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/jrfaeder/subscriptions", "organizations_url": "https://api.github.com/users/jrfaeder/orgs", "repos_url": "https://api.github.com/users/jrfaeder/repos", "events_url": "https://api.github.com/users/jrfaeder/events{/privacy}", "received_events_url": "https://api.github.com/users/jrfaeder/received_events", "type": "User", "site_admin": false}, "node_id": "RE_kwDOAe1CjM4Ijj4s", "tag_name": "BioNetGen-2.9.1", "target_commitish": "master", "name": "BioNetGen-2.9.1", "draft": false, "prerelease": false, "created_at": "2024-02-25T22:15:48Z", "published_at": "2024-02-26T15:19:58Z", "assets": [{"url": "https://api.github.com/repos/RuleWorld/bionetgen/releases/assets/153825093", "id": 153825093, "node_id": "RA_kwDOAe1CjM4JKy9F", "name": "BioNetGen-2.9.1-linux.tar.gz", "label": null, "uploader": {"login": "jrfaeder", "id": 8277248, "node_id": "MDQ6VXNlcjgyNzcyNDg=", "avatar_url": "https://avatars.githubusercontent.com/u/8277248?v=4", "gravatar_id": "", "url": "https://api.github.com/users/jrfaeder", "html_url": "https://github.com/jrfaeder", "followers_url": "https://api.github.com/users/jrfaeder/followers", "following_url": "https://api.github.com/users/jrfaeder/following{/other_user}", "gists_url": "https://api.github.com/users/jrfaeder/gists{/gist_id}", "starred_url": "https://api.github.com/users/jrfaeder/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/jrfaeder/subscriptions", "organizations_url": "https://api.github.com/users/jrfaeder/orgs", "repos_url": "https://api.github.com/users/jrfaeder/repos", "events_url": "https://api.github.com/users/jrfaeder/events{/privacy}", "received_events_url": "https://api.github.com/users/jrfaeder/received_events", "type": "User", "site_admin": false}, "content_type": "application/x-gzip", "state": "uploaded", "size": 10002325, "download_count": 0, "created_at": "2024-02-27T14:51:05Z", "updated_at": "2024-02-27T14:51:06Z", "browser_download_url": "https://github.com/RuleWorld/bionetgen/releases/download/BioNetGen-2.9.1/BioNetGen-2.9.1-linux.tar.gz"}, {"url": "https://api.github.com/repos/RuleWorld/bionetgen/releases/assets/153825089", "id": 153825089, "node_id": "RA_kwDOAe1CjM4JKy9B", "name": "BioNetGen-2.9.1-mac.tar.gz", "label": null, "uploader": {"login": "jrfaeder", "id": 8277248, "node_id": "MDQ6VXNlcjgyNzcyNDg=", "avatar_url": "https://avatars.githubusercontent.com/u/8277248?v=4", "gravatar_id": "", "url": "https://api.github.com/users/jrfaeder", "html_url": "https://github.com/jrfaeder", "followers_url": "https://api.github.com/users/jrfaeder/followers", "following_url": "https://api.github.com/users/jrfaeder/following{/other_user}", "gists_url": "https://api.github.com/users/jrfaeder/gists{/gist_id}", "starred_url": "https://api.github.com/users/jrfaeder/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/jrfaeder/subscriptions", "organizations_url": "https://api.github.com/users/jrfaeder/orgs", "repos_url": "https://api.github.com/users/jrfaeder/repos", "events_url": "https://api.github.com/users/jrfaeder/events{/privacy}", "received_events_url": "https://api.github.com/users/jrfaeder/received_events", "type": "User", "site_admin": false}, "content_type": "application/x-gzip", "state": "uploaded", "size": 9118082, "download_count": 0, "created_at": "2024-02-27T14:51:04Z", "updated_at": "2024-02-27T14:51:05Z", "browser_download_url": "https://github.com/RuleWorld/bionetgen/releases/download/BioNetGen-2.9.1/BioNetGen-2.9.1-mac.tar.gz"}, {"url": "https://api.github.com/repos/RuleWorld/bionetgen/releases/assets/153825082", "id": 153825082, "node_id": "RA_kwDOAe1CjM4JKy86", "name": "BioNetGen-2.9.1-win.tar.gz", "label": null, "uploader": {"login": "jrfaeder", "id": 8277248, "node_id": "MDQ6VXNlcjgyNzcyNDg=", "avatar_url": "https://avatars.githubusercontent.com/u/8277248?v=4", "gravatar_id": "", "url": "https://api.github.com/users/jrfaeder", "html_url": "https://github.com/jrfaeder", "followers_url": "https://api.github.com/users/jrfaeder/followers", "following_url": "https://api.github.com/users/jrfaeder/following{/other_user}", "gists_url": "https://api.github.com/users/jrfaeder/gists{/gist_id}", "starred_url": "https://api.github.com/users/jrfaeder/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/jrfaeder/subscriptions", "organizations_url": "https://api.github.com/users/jrfaeder/orgs", "repos_url": "https://api.github.com/users/jrfaeder/repos", "events_url": "https://api.github.com/users/jrfaeder/events{/privacy}", "received_events_url": "https://api.github.com/users/jrfaeder/received_events", "type": "User", "site_admin": false}, "content_type": "application/x-gzip", "state": "uploaded", "size": 22154721, "download_count": 0, "created_at": "2024-02-27T14:51:03Z", "updated_at": "2024-02-27T14:51:04Z", "browser_download_url": "https://github.com/RuleWorld/bionetgen/releases/download/BioNetGen-2.9.1/BioNetGen-2.9.1-win.tar.gz"}], "tarball_url": "https://api.github.com/repos/RuleWorld/bionetgen/tarball/BioNetGen-2.9.1", "zipball_url": "https://api.github.com/repos/RuleWorld/bionetgen/zipball/BioNetGen-2.9.1", "body": "Fixes a bug that led to invalid SBML files being produced when there were internal variables in a BNGL models. These are produced when anything other than a simple parameter name is used in a RateLaw associated with a rule.\r\n\r\n*NOTE:* These bundles do not include binaries for sbmlTranslator or library files for compiling and linking to the CVODE library. These files are included in previous release bundles if you need them. For import and atomization of SBML models we strongly suggest you use the Atomizer library and tools included in the latest release of PyBioNetGen. Its functionality and reliability is much greater than that of the old sbmlTranslator code.\r\n\r\n**Full Changelog**: https://github.com/RuleWorld/bionetgen/compare/BioNetGen-2.9.0...BioNetGen-2.9.1"} \ No newline at end of file diff --git a/setup.py b/setup.py index 921409b..5512444 100644 --- a/setup.py +++ b/setup.py @@ -1,5 +1,16 @@ from setuptools import setup, find_packages import sys, os, json, urllib, subprocess +import shutil, tarfile, zipfile + +# Utility function for Mac idiosyncracy +def get_folder (arch): + for fname in arch.getnames(): + if (fname.startswith('._')): + continue + else: + break + print(fname) + return(fname) subprocess.check_call([sys.executable, "-m", "pip", "install", "numpy"]) import urllib.request @@ -22,7 +33,7 @@ bng_version_tag = rls_json["tag_name"] with open("bionetgen/assets/BNGVERSION", "w") as f: f.write(bng_version_tag) -# get assests +# get assets assets = rls_json["assets"] for asset in assets: browser_url = asset["browser_download_url"] @@ -36,7 +47,6 @@ windows_url = browser_url # next download and place the appropriate files -import os, shutil, tarfile, zipfile bng_downloaded = False for iurl, bng_url in enumerate([linux_url, mac_url, windows_url]): @@ -72,13 +82,17 @@ ext = bng_url.split(".")[-1] fname = "bng.{}".format(ext) # download bng distro + print(bng_url, fname) urllib.request.urlretrieve(bng_url, fname) # file extension dependent actions, tar for # mac and linux, zip for windows if iurl < 2: # if "tgz" == ext or "gz" == etx: bng_arch = tarfile.open(fname) - fold_name = bng_arch.getnames()[0] + # Find containing folder of the archive. + # On macs may need to skip first item because + # filesystem makes shadow files with `._` prepended. + fold_name = get_folder(bng_arch) bng_arch.extractall() # make sure bionetgen/bng exists if iurl == 0: @@ -114,7 +128,7 @@ # fold_name = bng_arch.namelist()[0] # bng_arch.extractall() bng_arch = tarfile.open(fname) - fold_name = bng_arch.getnames()[0] + fold_name = get_folder(bng_arch) bng_arch.extractall() # bng folder if iurl == 2: diff --git a/test_tarfile.ipynb b/test_tarfile.ipynb new file mode 100755 index 0000000..60f46a0 --- /dev/null +++ b/test_tarfile.ipynb @@ -0,0 +1,66 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [], + "source": [ + "import tarfile" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "BioNetGen-2.9.1\n" + ] + } + ], + "source": [ + "fname=\"bng.gz\"\n", + "bng_arch = tarfile.open(fname)\n", + "for i in range(2):\n", + " fold_name = bng_arch.getnames()[i]\n", + " if (fold_name.startswith('._')):\n", + " continue\n", + " else:\n", + " break\n", + "print(fold_name)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "base", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.9.7" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +}