File size: 1,927 Bytes
cf8614b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import codecs
import os
import os.path
from os.path import join

from setuptools import setup

import cffi_build.cffi_build as cffi_build


def read(rel_path):
    here = os.path.abspath(os.path.dirname(__file__))
    with codecs.open(os.path.join(here, rel_path), 'r') as fp:
        return fp.read()


def get_version(rel_path):
    for line in read(rel_path).splitlines():
        if line.startswith('__version__'):
            delim = '"' if '"' in line else "'"
            return line.split(delim)[1]
    else:
        raise RuntimeError("Unable to find version string.")


# Temp fix for CoppeliaSim 4.1
if 'COPPELIASIM_ROOT' not in os.environ:
    raise RuntimeError('COPPELIASIM_ROOT not defined.')

usrset_file = os.path.join(os.environ['COPPELIASIM_ROOT'], 'system', 'usrset.txt')
usrset = ''
if os.path.isfile(usrset_file):
    with open(usrset_file, 'r') as f:
        usrset = f.read()

if 'allowOldEduRelease' not in usrset:
    with open(usrset_file, 'a+') as f:
        f.write('\nallowOldEduRelease=7501\n')


setup(name='PyRep',
      # Version A.B.C.D.
      # A.B.C info corresponds to the CoppeliaSim version needed.
      # D info corresponds to the PyRep version.
      version=get_version("pyrep/__init__.py"),
      description='Python CoppeliaSim wrapper',
      author='Stephen James',
      author_email='slj12@ic.ac.uk',
      url='https://www.doc.ic.ac.uk/~slj12',
      packages=['pyrep',
                'pyrep.backend',
                'pyrep.objects',
                'pyrep.sensors',
                'pyrep.robots',
                'pyrep.robots.arms',
                'pyrep.robots.end_effectors',
                'pyrep.robots.mobiles',
                'pyrep.robots.configuration_paths',
                'pyrep.textures',
                'pyrep.misc',
                ],
      ext_modules=[cffi_build.ffibuilder.distutils_extension(
          join('build', 'pyrep', 'backend'))],
      )