# HG changeset patch # User fubar # Date 1597582309 14400 # Node ID 23ad2924bf785d542d974e6decc553b0d3453a52 # Parent e7e9732ebed6c0630d8bc242bd0e1aaf97ed2414 Deleted selected files diff -r e7e9732ebed6 -r 23ad2924bf78 toolfactory/.github/workflows/commit.yml --- a/toolfactory/.github/workflows/commit.yml Sun Aug 16 08:51:14 2020 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,68 +0,0 @@ -name: Galaxy Tool Linting and Tests for PR -# run planemo on a git repository containing a single tool -# as a github action. Does NOT run flake8. So, bite me. -# ross lazarus august 2020 -on: [pull_request,push] -env: - GALAXY_REPO: https://github.com/galaxyproject/galaxy - GALAXY_RELEASE: release_20.05 -jobs: - setup: - name: setup environment and python - runs-on: ubuntu-latest - strategy: - matrix: - python-version: [3.7] - steps: - - name: Print github context properties - run: | - echo 'event: ${{ github.event_name }}' - echo 'sha: ${{ github.sha }}' - echo 'ref: ${{ github.ref }}' - echo 'head_ref: ${{ github.head_ref }}' - echo 'base_ref: ${{ github.base_ref }}' - echo 'event.before: ${{ github.event.before }}' - echo 'event.after: ${{ github.event.after }}' - - uses: actions/setup-python@v1 - with: - python-version: ${{ matrix.python-version }} - - uses: actions/checkout@v2 - with: - # planemo does not seem to want to install the requirement galaxyxml - # into the venv it manages at tool testing so do it the old skool way - repository: 'galaxyproject/galaxy' - path: 'galaxy' - - name: make venv ready for this galaxy and planemo - run: | - python3 -m venv $GITHUB_WORKSPACE/galaxy/.venv - . $GITHUB_WORKSPACE/galaxy/.venv/bin/activate - pip install --upgrade pip - pip install wheel - pip install -r $GITHUB_WORKSPACE/galaxy/requirements.txt - # pip install galaxyxml # currently includes a patched working version awaiting PR merge - - name: Upgrade pip - run: pip install --upgrade pip - # Install the `wheel` package so that when installing other packages which - # are not available as wheels, pip will build a wheel for them, which can be cached. - - name: Install wheel - run: pip install wheel - - name: Install Planemo and flake8 - run: pip install planemo flake8 flake8-import-order - # galaxyxml temporarily removed until PR accepted - - uses: actions/checkout@v2 - with: - fetch-depth: 1 - - name: flake8 - run: flake8 --ignore=E2,E3,E4,E5,W3,W505 - - name: Planemo lint - run: planemo lint . - - name: Planemo test tool - run: planemo test --galaxy_root $GITHUB_WORKSPACE/galaxy --test_output tool_test_output.html --skip_venv --test_output_json tool_test_output.json --galaxy_python_version ${{ matrix.python-version }} . - - name: Copy artifacts into place - run: | - mkdir upload - mv tool_test_output.json tool_test_output.html upload/ - - uses: actions/upload-artifact@v2.0.1 - with: - name: 'All tool test results' - path: upload diff -r e7e9732ebed6 -r 23ad2924bf78 toolfactory/.gitignore --- a/toolfactory/.gitignore Sun Aug 16 08:51:14 2020 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,129 +0,0 @@ -# Byte-compiled / optimized / DLL files -__pycache__/ -*.py[cod] -*$py.class - -# C extensions -*.so - -# Distribution / packaging -.Python -build/ -develop-eggs/ -dist/ -downloads/ -eggs/ -.eggs/ -lib/ -lib64/ -parts/ -sdist/ -var/ -wheels/ -pip-wheel-metadata/ -share/python-wheels/ -*.egg-info/ -.installed.cfg -*.egg -MANIFEST - -# PyInstaller -# Usually these files are written by a python script from a template -# before PyInstaller builds the exe, so as to inject date/other infos into it. -*.manifest -*.spec - -# Installer logs -pip-log.txt -pip-delete-this-directory.txt - -# Unit test / coverage reports -htmlcov/ -.tox/ -.nox/ -.coverage -.coverage.* -.cache -nosetests.xml -coverage.xml -*.cover -*.py,cover -.hypothesis/ -.pytest_cache/ - -# Translations -*.mo -*.pot - -# Django stuff: -*.log -local_settings.py -db.sqlite3 -db.sqlite3-journal - -# Flask stuff: -instance/ -.webassets-cache - -# Scrapy stuff: -.scrapy - -# Sphinx documentation -docs/_build/ - -# PyBuilder -target/ - -# Jupyter Notebook -.ipynb_checkpoints - -# IPython -profile_default/ -ipython_config.py - -# pyenv -.python-version - -# pipenv -# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. -# However, in case of collaboration, if having platform-specific dependencies or dependencies -# having no cross-platform support, pipenv may install dependencies that don't work, or not -# install all needed dependencies. -#Pipfile.lock - -# PEP 582; used by e.g. github.com/David-OConnor/pyflow -__pypackages__/ - -# Celery stuff -celerybeat-schedule -celerybeat.pid - -# SageMath parsed files -*.sage.py - -# Environments -.env -.venv -env/ -venv/ -ENV/ -env.bak/ -venv.bak/ - -# Spyder project settings -.spyderproject -.spyproject - -# Rope project settings -.ropeproject - -# mkdocs documentation -/site - -# mypy -.mypy_cache/ -.dmypy.json -dmypy.json - -# Pyre type checker -.pyre/ diff -r e7e9732ebed6 -r 23ad2924bf78 toolfactory/.shed.yml --- a/toolfactory/.shed.yml Sun Aug 16 08:51:14 2020 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,13 +0,0 @@ -name: toolfactory -owner: fubar -description: ToolFactory - tool to make Galaxy tools ready for the toolshed -homepage_url: https://github.com/fubar2/toolfactory -long_description: | - ToolFactory - turn executable packages and R/python/perl/bash scripts into ordinary Galaxy tools - - Creating re-usable tools from scripts: The Galaxy Tool Factory Ross Lazarus; Antony Kaspi; Mark Ziemann; The Galaxy Team - Bioinformatics 2012; doi: 10.1093/bioinformatics/bts573 -remote_repository_url: https://github.com/fubar2/toolfactory -type: tool_dependency_definition -categories: -- Tool Generators diff -r e7e9732ebed6 -r 23ad2924bf78 toolfactory/html_dir.py --- a/toolfactory/html_dir.py Sun Aug 16 08:51:14 2020 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,180 +0,0 @@ - -class tooloutHTMLifyer(self): - - def compressPDF(self,inpdf=None,thumbformat='png'): - """need absolute path to pdf - note that GS gets confoozled if no $TMP or $TEMP - so we set it - """ - assert os.path.isfile(inpdf), "## Input %s supplied to %s compressPDF not found" % (inpdf,self.myName) - hlog = os.path.join(self.opts.output_dir,"compress_%s.txt" % os.path.basename(inpdf)) - sto = open(hlog,'a') - our_env = os.environ.copy() - our_tmp = our_env.get('TMP',None) - if not our_tmp: - our_tmp = our_env.get('TEMP',None) - if not (our_tmp and os.path.exists(our_tmp)): - newtmp = os.path.join(self.opts.output_dir,'tmp') - try: - os.mkdir(newtmp) - except: - sto.write('## WARNING - cannot make %s - it may exist or permissions need fixing\n' % newtmp) - our_env['TEMP'] = newtmp - if not self.temp_warned: - sto.write('## WARNING - no $TMP or $TEMP!!! Please fix - using %s temporarily\n' % newtmp) - self.temp_warned = True - outpdf = '%s_compressed' % inpdf - cl = ["gs", "-sDEVICE=pdfwrite", "-dNOPAUSE", "-dUseCIEColor", "-dBATCH","-dPDFSETTINGS=/printer", "-sOutputFile=%s" % outpdf,inpdf] - x = subprocess.Popen(cl,stdout=sto,stderr=sto,cwd=self.opts.output_dir,env=our_env) - retval1 = x.wait() - sto.close() - if retval1 == 0: - os.unlink(inpdf) - shutil.move(outpdf,inpdf) - os.unlink(hlog) - hlog = os.path.join(self.opts.output_dir,"thumbnail_%s.txt" % os.path.basename(inpdf)) - sto = open(hlog,'w') - outpng = '%s.%s' % (os.path.splitext(inpdf)[0],thumbformat) - if self.useGM: - cl2 = ['gm', 'convert', inpdf, outpng] - else: # assume imagemagick - cl2 = ['convert', inpdf, outpng] - x = subprocess.Popen(cl2,stdout=sto,stderr=sto,cwd=self.opts.output_dir,env=our_env) - retval2 = x.wait() - sto.close() - if retval2 == 0: - os.unlink(hlog) - retval = retval1 or retval2 - return retval - - - def getfSize(self,fpath,outpath): - """ - format a nice file size string - """ - size = '' - fp = os.path.join(outpath,fpath) - if os.path.isfile(fp): - size = '0 B' - n = float(os.path.getsize(fp)) - if n > 2**20: - size = '%1.1f MB' % (n/2**20) - elif n > 2**10: - size = '%1.1f KB' % (n/2**10) - elif n > 0: - size = '%d B' % (int(n)) - return size - - def makeHtml(self): - """ Create an HTML file content to list all the artifacts found in the output_dir - """ - - galhtmlprefix = """ - - - - - - - -
- """ - galhtmlattr = """
This tool (%s) was generated by the Galaxy Tool Factory

""" - galhtmlpostfix = """
\n""" - - flist = os.listdir(self.opts.output_dir) - flist = [x for x in flist if x != 'Rplots.pdf'] - flist.sort() - html = [] - html.append(galhtmlprefix % progname) - html.append('
Galaxy Tool "%s" run at %s

' % (self.toolname,timenow())) - fhtml = [] - if len(flist) > 0: - logfiles = [x for x in flist if x.lower().endswith('.log')] # log file names determine sections - logfiles.sort() - logfiles = [x for x in logfiles if os.path.abspath(x) != os.path.abspath(self.tlog)] - logfiles.append(os.path.abspath(self.tlog)) # make it the last one - pdflist = [] - npdf = len([x for x in flist if os.path.splitext(x)[-1].lower() == '.pdf']) - for rownum,fname in enumerate(flist): - dname,e = os.path.splitext(fname) - sfsize = self.getfSize(fname,self.opts.output_dir) - if e.lower() == '.pdf' : # compress and make a thumbnail - thumb = '%s.%s' % (dname,self.thumbformat) - pdff = os.path.join(self.opts.output_dir,fname) - retval = self.compressPDF(inpdf=pdff,thumbformat=self.thumbformat) - if retval == 0: - pdflist.append((fname,thumb)) - else: - pdflist.append((fname,fname)) - if (rownum+1) % 2 == 0: - fhtml.append('%s%s' % (fname,fname,sfsize)) - else: - fhtml.append('%s%s' % (fname,fname,sfsize)) - for logfname in logfiles: # expect at least tlog - if more - if os.path.abspath(logfname) == os.path.abspath(self.tlog): # handled later - sectionname = 'All tool run' - if (len(logfiles) > 1): - sectionname = 'Other' - ourpdfs = pdflist - else: - realname = os.path.basename(logfname) - sectionname = os.path.splitext(realname)[0].split('_')[0] # break in case _ added to log - ourpdfs = [x for x in pdflist if os.path.basename(x[0]).split('_')[0] == sectionname] - pdflist = [x for x in pdflist if os.path.basename(x[0]).split('_')[0] != sectionname] # remove - nacross = 1 - npdf = len(ourpdfs) - - if npdf > 0: - nacross = math.sqrt(npdf) ## int(round(math.log(npdf,2))) - if int(nacross)**2 != npdf: - nacross += 1 - nacross = int(nacross) - width = min(400,int(1200/nacross)) - html.append('
%s images and outputs
' % sectionname) - html.append('(Click on a thumbnail image to download the corresponding original PDF image)
') - ntogo = nacross # counter for table row padding with empty cells - html.append('
\n') - for i,paths in enumerate(ourpdfs): - fname,thumb = paths - s= """\n""" % (fname,thumb,fname,width,fname) - if ((i+1) % nacross == 0): - s += '\n' - ntogo = 0 - if i < (npdf - 1): # more to come - s += '' - ntogo = nacross - else: - ntogo -= 1 - html.append(s) - if html[-1].strip().endswith(''): - html.append('
Image called %s
\n') - else: - if ntogo > 0: # pad - html.append(' '*ntogo) - html.append('\n') - logt = open(logfname,'r').readlines() - logtext = [x for x in logt if x.strip() > ''] - html.append('
%s log output
' % sectionname) - if len(logtext) > 1: - html.append('\n
\n')
-                    html += logtext
-                    html.append('\n
\n') - else: - html.append('%s is empty
' % logfname) - if len(fhtml) > 0: - fhtml.insert(0,'
\n') - fhtml.append('
Output File Name (click to view)Size

') - html.append('
All output files available for downloading
\n') - html += fhtml # add all non-pdf files to the end of the display - else: - html.append('
### Error - %s returned no files - please confirm that parameters are sane
' % self.opts.interpreter) - html.append(galhtmlpostfix) - htmlf = file(self.opts.output_html,'w') - htmlf.write('\n'.join(html)) - htmlf.write('\n') - htmlf.close() - self.html = html - - diff -r e7e9732ebed6 -r 23ad2924bf78 toolfactory/testtf.sh --- a/toolfactory/testtf.sh Sun Aug 16 08:51:14 2020 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,2 +0,0 @@ -planemo test --no_cleanup --no_dependency_resolution --skip_venv --galaxy_root ~/galaxy ~/galaxy/tools/tool_makers/toolfactory &>foo -