push sheeet
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s

This commit is contained in:
Dark Steveneq
2025-10-09 14:15:47 +02:00
commit 646b892680
49168 changed files with 5897842 additions and 0 deletions

View File

@@ -0,0 +1,50 @@
{
lib,
buildPythonPackage,
fetchPypi,
replaceVars,
pyparsing,
graphviz,
pytestCheckHook,
texliveSmall,
}:
buildPythonPackage rec {
pname = "dot2tex";
version = "2.11.3";
format = "setuptools";
src = fetchPypi {
inherit pname version;
hash = "sha256-KZoq8FruW74CV6VipQapPieSk9XDjyjQirissyM/584=";
};
patches = [
(replaceVars ./path.patch {
inherit graphviz;
})
./test.patch # https://github.com/kjellmf/dot2tex/issues/5
# https://github.com/xyz2tex/dot2tex/pull/104 does not merge cleanly
./remove-duplicate-script.patch
];
propagatedBuildInputs = [ pyparsing ];
nativeCheckInputs = [
pytestCheckHook
(texliveSmall.withPackages (
ps: with ps; [
preview
pstricks
]
))
];
meta = with lib; {
description = "Convert graphs generated by Graphviz to LaTeX friendly formats";
mainProgram = "dot2tex";
homepage = "https://github.com/kjellmf/dot2tex";
license = licenses.mit;
};
}

View File

@@ -0,0 +1,104 @@
diff --git a/dot2tex/dotparsing.py b/dot2tex/dotparsing.py
index 391b5dc..6dc77a3 100644
--- a/dot2tex/dotparsing.py
+++ b/dot2tex/dotparsing.py
@@ -180,18 +180,8 @@ def __find_executables(path):
def find_graphviz():
"""Locate Graphviz's executables in the system.
- Tries three methods:
-
- First: Windows Registry (Windows only)
- This requires Mark Hammond's pywin32 is installed.
-
- Secondly: Search the path
- It will look for 'dot', 'twopi' and 'neato' in all the directories
- specified in the PATH environment variable.
-
- Thirdly: Default install location (Windows only)
- It will look for 'dot', 'twopi' and 'neato' in the default install
- location under the "Program Files" directory.
+ It will look for 'dot', 'twopi' and 'neato' in
+ @graphviz@/bin.
It will return a dictionary containing the program names as keys
and their paths as values.
@@ -199,75 +189,9 @@ def find_graphviz():
If this fails, it returns None.
"""
- # Method 1 (Windows only)
- #
- if os.sys.platform == 'win32':
- try:
- import win32api, win32con
-
- # Get the GraphViz install path from the registry
- #
- hkey = win32api.RegOpenKeyEx(win32con.HKEY_LOCAL_MACHINE,
- "SOFTWARE\AT&T Research Labs\Graphviz", 0, win32con.KEY_QUERY_VALUE)
-
- path = win32api.RegQueryValueEx(hkey, "InstallPath")[0]
- win32api.RegCloseKey(hkey)
-
- # Now append the "bin" subdirectory:
- #
- path = os.path.join(path, "bin")
- progs = __find_executables(path)
- if progs is not None:
- # print("Used Windows registry")
- return progs
-
- except ImportError:
- # Print a messaged suggesting they install these?
- #
- log.debug('The win32api is not installed')
- pass
- except:
- log.debug('Failed to access the registry key')
-
- # Method 2 (Linux, Windows etc)
- #
- if 'PATH' in os.environ:
- for path in os.environ['PATH'].split(os.pathsep):
- progs = __find_executables(path)
- if progs is not None:
- return progs
-
- # Method 3 (Windows only)
- #
- if os.sys.platform == 'win32':
- # Try and work out the equivalent of "C:\Program Files" on this
- # machine (might be on drive D:, or in a different language)
- #
- if 'PROGRAMFILES' in os.environ:
- # Note, we could also use the win32api to get this
- # information, but win32api may not be installed.
-
- path = os.path.join(os.environ['PROGRAMFILES'], 'ATT', 'GraphViz', 'bin')
-
- else:
- # Just in case, try the default...
- path = r"C:\Program Files\att\Graphviz\bin"
-
- progs = __find_executables(path)
-
- if progs is not None:
- # print("Used default install location")
- return progs
-
- for path in (
- '/usr/bin', '/usr/local/bin',
- '/opt/local/bin',
- '/opt/bin', '/sw/bin', '/usr/share',
- '/Applications/Graphviz.app/Contents/MacOS/'):
- progs = __find_executables(path)
- if progs is not None:
- # print("Used path")
- return progs
+ progs = __find_executables('@graphviz@/bin')
+ if progs is not None:
+ return progs
# Failed to find GraphViz
#

View File

@@ -0,0 +1,34 @@
From 98a0fbd0c4e13df98b8fb69c241665ab774fda2e Mon Sep 17 00:00:00 2001
From: Theodore Ni <3806110+tjni@users.noreply.github.com>
Date: Fri, 11 Aug 2023 21:58:14 -0700
Subject: [PATCH] Remove script with same name as entry point
---
dot2tex/dot2tex | 5 -----
setup.py | 1 -
2 files changed, 6 deletions(-)
delete mode 100644 dot2tex/dot2tex
diff --git a/dot2tex/dot2tex b/dot2tex/dot2tex
deleted file mode 100644
index 278c0b3..0000000
--- a/dot2tex/dot2tex
+++ /dev/null
@@ -1,5 +0,0 @@
-#!/usr/bin/env python
-from .dot2tex import main
-
-if __name__ == '__main__':
- main()
diff --git a/setup.py b/setup.py
index d05db37..67a3ee8 100644
--- a/setup.py
+++ b/setup.py
@@ -21,7 +21,6 @@
author_email='kjellmf@gmail.com',
url="https://github.com/kjellmf/dot2tex",
py_modules=['dot2tex.dot2tex', 'dot2tex.dotparsing'],
- scripts=['dot2tex/dot2tex'],
classifiers=[
'Development Status :: 4 - Beta',
'Environment :: Console',

View File

@@ -0,0 +1,12 @@
diff --git a/tests/test_dot2tex.py b/tests/test_dot2tex.py
index 74b01ed..7be9aba 100644
--- a/tests/test_dot2tex.py
+++ b/tests/test_dot2tex.py
@@ -147,6 +147,7 @@ class NeedsQuotesTests(unittest.TestCase):
class MultipleStatements(unittest.TestCase):
# https://github.com/kjellmf/dot2tex/issues/5
+ @unittest.skip('fails upstream')
def test_semicolon(self):
"""Test for issue 5"""
testgraph1 = """