Skip to content

Commit

Permalink
Fix build data dir inclusion. Prevent import of data dirs.
Browse files Browse the repository at this point in the history
  • Loading branch information
lhupfeldt committed Oct 23, 2024
1 parent a3701b9 commit a5ecccf
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 19 deletions.
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
include *.rst *.md *.txt
recursive-include src/visual *.css *.js *.html *.md
recursive-include test *.tenjin *.py
5 changes: 3 additions & 2 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import glob
from pathlib import Path
import subprocess
import shutil
from typing import Sequence

import nox
Expand Down Expand Up @@ -181,9 +182,9 @@ def unit(session):

@nox.session(python=_PY_VERSIONS[0], reuse_venv=True)
def build(session):
if Path("dist").is_dir():
shutil.rmtree("dist")
session.install("build>=1.0.3", "twine>=4.0.2")
for ff in glob.glob("dist/*"):
os.remove(ff)
session.run("python", "-m", "build")
session.run("python", "-m", "twine", "check", "dist/*")

Expand Down
12 changes: 12 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,23 @@ packages =
jenkinsflow
jenkinsflow.utils
jenkinsflow.cli
jenkinsflow.visual
# https://github.com/pypa/setuptools/issues/3340
jenkinsflow.visual.js
jenkinsflow.visual.stylesheets

package_dir =
jenkinsflow = src
jenkinsflow.utils = src/utils
jenkinsflow.cli = src/cli
jenkinsflow.visual = src/visual
jenkinsflow.visual.js = src/visual/js
jenkinsflow.visual.stylesheets = src/visual/stylesheets

[options.data_files]
src/visual = *.html
src/visual/js = *.js
src/visual/stylesheets = *.css

[options.entry_points]
console_scripts =
Expand Down
1 change: 0 additions & 1 deletion src/visual/README.md

This file was deleted.

3 changes: 3 additions & 0 deletions src/visual/js/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from pathlib import Path

raise ImportError(f"Directory '{Path(__file__).parent}' is a data dir, not a package.")
16 changes: 0 additions & 16 deletions src/visual/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,22 +34,6 @@ def stylesheets(filename):

@post('/jenkinsflow/builds')
def builds():
# TODO: change this to jenkins_api call because this url
# returns html table, and we only need job names and state of the build
# api = Jenkins(jenkins_url)
# simple_queue = []
# if len(api.get_queue()):
# for item in api.get_queue().values():
# print 'queue item: %s %s' % (type(item), item)
# job = api[item.task['name']]
# print 'job: %s %s' % (type(job), job)
# build = job.get_last_build_or_none()
# simple_queue.append({'job': job.name,
# 'running': job.is_running(),
# 'job_id': build.get_number()
# if build is not None else '???'})

# print 'DEBUG: simple_queue=', simple_queue
rsp = requests.get(jenkins_url + 'queue/api/json')
response.content_type = 'application/json'
return json.dumps(rsp.json())
Expand Down
3 changes: 3 additions & 0 deletions src/visual/stylesheets/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from pathlib import Path

raise ImportError(f"Directory '{Path(__file__).parent}' is a data dir, not a package.")
File renamed without changes.

0 comments on commit a5ecccf

Please sign in to comment.