Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setuptools installation round 3 #7

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,8 @@ build/

# ignore CLion builds
cmake-build-*/

xdm_bdl.egg-info
*.so
src/python/xdm_bdl.py
dist
58 changes: 58 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
from setuptools import setup, Extension, find_packages
from setuptools.command.install_scripts import install_scripts
from setuptools.command.develop import develop
import os

XDM_VERSION = "2.4.0"

def set_xdm_version():
source_file = os.path.join(os.path.dirname(__file__),
"src", "python", "xdm.py.in")
with open(source_file, 'r') as fi:
src_data = fi.read()
target_file = os.path.join(os.path.dirname(__file__),
"src", "python", "xdm_bdl.py")
with open(target_file, 'w') as fo:
fo.write(src_data.replace(
"@XDM_MAJOR_VERSION@.@XDM_MINOR_VERSION@.@XDM_PATCH_VERSION@",
XDM_VERSION))

class install_xdm(install_scripts):
def run(self):
set_xdm_version()
install_scripts.run(self)

class develop_xdm(develop):
def run(self):
set_xdm_version()
develop.run(self)

setup( name = 'xdm_bdl',
version = XDM_VERSION,
description = 'Xyce(TM) XDM Netlist Translator',
author = 'National Technology & Engineering Solutions of Sandia, LLC',
ext_modules = [
Extension('XdmRapidXmlReader',
include_dirs = ['src/c_boost/xml/rapidxml/rapidxml-1.13'],
libraries = ['boost_python3-mt'],
sources = ['src/c_boost/xml/xdm_rapid.cpp']),
Extension('SpiritExprCommon',
libraries = ['boost_python3-mt'],
sources = ['src/c_boost/expr/expr_parser_interface.cpp',
'src/c_boost/expr/hspice_expr_parser_interface.cpp',
'src/c_boost/expr/spectre_expr_parser_interface.cpp']),
Extension('SpiritCommon',
libraries = ['boost_python3-mt'],
sources = ['src/c_boost/xyce/parser_interface.cpp',
'src/c_boost/xyce/xyce_parser_interface.cpp',
'src/c_boost/xyce/hspice_parser_interface.cpp',
'src/c_boost/xyce/spectre_parser_interface.cpp',
'src/c_boost/xyce/pspice_parser_interface.cpp',
'src/c_boost/xyce/tspice_parser_interface.cpp'])
],
package_dir={'': 'src/python'},
packages=find_packages(where='src/python'),
package_data={'': ['schema/*.xml'],},
scripts=['src/python/xdm_bdl.py'],
cmdclass={'install_scripts': install_xdm, 'develop': develop_xdm},
)
15 changes: 9 additions & 6 deletions src/python/xdm.py.in
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import types
# from copy import deepcopy
# from collections import OrderedDict
# from pprint import pformat
import xdm
from xdm.errorHandling.CallCount import CallCount
from xdm.index.DEVICES_INDEX import DEVICES_INDEX
from xdm.index.SRC_LINE_INDEX import SRC_LINE_INDEX
Expand Down Expand Up @@ -120,7 +121,7 @@ def get_value(current_device):
return 'Unknown'


base_path = execDirName
base_path = os.path.dirname(xdm.__file__)
xdm_mod_date = str(modification_date(sys.executable))

parser = argparse.ArgumentParser(
Expand Down Expand Up @@ -214,12 +215,14 @@ origin_combine_off_dict = {
'spectre': True
}

xml_path = os.path.join(os.path.dirname(xdm.inout.xml.__file__), "schema/")

xml_files = {
'xyce': os.path.join(base_path, "xyce.xml"),
'pspice': os.path.join(base_path, "pspice.xml"),
'hspice': os.path.join(base_path, "hspice.xml"),
'tspice': os.path.join(base_path, "tspice.xml"),
'spectre': os.path.join(base_path, "spectre.xml")
'xyce': os.path.join(xml_path, "xyce.xml"),
'pspice': os.path.join(xml_path, "pspice.xml"),
'hspice': os.path.join(xml_path, "hspice.xml"),
'tspice': os.path.join(xml_path, "tspice.xml"),
'spectre': os.path.join(xml_path, "spectre.xml")
}

pspice_xml = xml_files['pspice']
Expand Down