File: setup.py.in

package info (click to toggle)
ghdl 0.35%2Bgit20181129%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 49,976 kB
  • sloc: vhdl: 206,961; ada: 185,583; ansic: 19,771; sh: 6,718; python: 2,961; makefile: 1,137; cpp: 51; exp: 40; asm: 22; csh: 20
file content (49 lines) | stat: -rw-r--r-- 1,674 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/usr/bin/env python

from distutils.core import setup, Extension
import distutils.file_util
import distutils.dir_util
from distutils.command.build import build
import os
import os.path

so_ext = "@SOEXT@"
libghdl_version = "@libghdl_version@"

class GHDLBuild(build):
    def my_copy_tree(self, src, dst):
        """Tuned version of copy_tree: exclude .o files"""
        distutils.dir_util.mkpath(dst, verbose=True)

        for n in os.listdir(src):
            src_name = os.path.join(src, n)
            dst_name = os.path.join(dst, n)

            if os.path.isdir(src_name):
                self.my_copy_tree(src_name, dst_name)
            elif not src_name.endswith(".o"):
                distutils.file_util.copy_file(src_name, dst_name)

    def run(self):
        # Run original build code
        build.run(self)

        # Copy VHDL libraries & shared library
        dstdir = os.path.join(self.build_lib, 'libghdl')
        libghdl_filename = "libghdl-" + libghdl_version + so_ext
        distutils.file_util.copy_file(libghdl_filename, dstdir)
        with open(os.path.join(dstdir, "config.py"), 'w') as f:
            f.write('libghdl_filename="{}"\n'.format(libghdl_filename))
        self.my_copy_tree(os.path.join("lib", "ghdl"),
                          os.path.join(dstdir, "ghdl"))

setup (name='libghdl',
       version='0.35',
       description = 'Interface to ghdl, a VHDL analyzer',
       author = 'Tristan Gingold',
       author_email = 'tgingold@free.fr',
       url = 'github.com/ghdl/ghdl',
       package_dir = {'libghdl' : 'src/vhdl/python/libghdl'},
       packages = ['libghdl'],
       cmdclass = {
           'build': GHDLBuild})