Exemple #1
0
    def cython_sources(self, sources, extension):

        # cythonize .pxd source files
        ret = build_ext.cython_sources(self, sources, extension)

        # should result the module name; e.g, graphics[.pyx]
        module = os.path.basename(sources[0])[:-4]

        # prepare a list with all header files related to the module (*.hpp, *_api.h, *.h)
        header_files = glob(
            os.path.join(SCRIPT_DIR, 'src', 'sfml', module, '*.hpp'))

        header_files.append(
            os.path.join(SCRIPT_DIR, 'src', 'sfml', module, module + '.h'))
        header_files.append(
            os.path.join(SCRIPT_DIR, 'src', 'sfml', module, module + '_api.h'))

        # deal with exceptions
        if module == "network":
            header_files.remove(
                os.path.join(SCRIPT_DIR, 'src', 'sfml', module, module + '.h'))
            header_files.remove(
                os.path.join(SCRIPT_DIR, 'src', 'sfml', module,
                             module + '_api.h'))

        # create the temporary destination in the build directory
        destination = os.path.join(self.build_temp, 'include', 'pysfml',
                                   module)

        if not os.path.exists(destination):
            os.makedirs(destination)

        # move all header files to the build directory
        for header_file in header_files:
            if os.path.isfile(header_file):
                try:
                    shutil.copy(header_file, destination)
                except shutil.Error:
                    pass

        # add the temporary header directory to compilation options
        self.compiler.include_dirs.append(
            os.path.join(self.build_temp, 'include'))

        # update data_files to install the files on the system

        # On Windows: C:\Python27\include\pysfml\*_api.h
        # On Unix: /usr/local/include/pysfml/*_api.h
        install_directory = os.path.join(sys.exec_prefix, 'include', 'pysfml',
                                         module)
        files_to_install = [
            os.path.join(self.build_temp, 'include', 'pysfml', module,
                         os.path.basename(header_file))
            for header_file in header_files
        ]
        data_files.append((install_directory, files_to_install))

        return ret
 def cython_sources(self, sources, extension):
     log.info("Compiling Cython extension %s" % extension.name)
     if extension.name == "sipsimple.core._core":
         self.build_dir = os.path.join(self.build_temp, "pjsip")
         if self.pjsip_clean_compile:
             self.clean_pjsip()
         copy_tree(self.pjsip_dir, self.build_dir, verbose=0)
         if not os.path.exists(os.path.join(self.build_dir, "build.mak")):
             self.configure_pjsip()
         self.update_extension(extension)
         self.compile_pjsip()
     return build_ext.cython_sources(self, sources, extension)
 def cython_sources(self, sources, extension):
     if extension.name == "sipsimple.core._core":
         self.check_cython_version()
         self.build_dir = os.path.join(self.build_temp, "pjsip")
         if self.pjsip_clean_compile:
             self.clean_pjsip()
         copy_tree(self.pjsip_dir, self.build_dir, verbose=0)
         if not os.path.exists(os.path.join(self.build_dir, "build.mak")):
             self.configure_pjsip()
         self.update_extension(extension)
         self.compile_pjsip()
     return build_ext.cython_sources(self, sources, extension)
Exemple #4
0
    def cython_sources(self, sources, extension):

        # cythonize .pxd source files
        ret = build_ext.cython_sources(self, sources, extension)

        # should result the module name; e.g, graphics[.pyx]
        module = os.path.basename(sources[0])[:-4]

        # prepare a list with all header files related to the module (*.hpp, *_api.h, *.h)
        header_files = glob(os.path.join("src", "sfml", module, "*.hpp"))

        header_files.append(os.path.join("src", "sfml", module, module + ".h"))
        header_files.append(os.path.join("src", "sfml", module, module + "_api.h"))

        # deal with exceptions
        if module == "network":
            header_files.remove(os.path.join("src", "sfml", module, module + ".h"))
            header_files.remove(os.path.join("src", "sfml", module, module + "_api.h"))

        # create the temporary destination in the build directory
        destination = os.path.join(self.build_temp, "include", "pysfml", module)

        if not os.path.exists(destination):
            os.makedirs(destination)

        # move all header files to the build directory
        for header_file in header_files:
            if os.path.isfile(header_file):
                try:
                    shutil.copy(header_file, destination)
                except shutil.Error:
                    pass

        # add the temporary header directory to compilation options
        self.compiler.include_dirs.append(os.path.join(self.build_temp, "include"))

        # update data_files to install the files on the system

        # On Windows: C:\Python27\include\pysfml\*_api.h
        # On Unix: /usr/local/include/pysfml/*_api.h
        install_directory = os.path.join(sys.exec_prefix, "include", "pysfml", module)
        files_to_install = [
            os.path.join(self.build_temp, "include", "pysfml", module, os.path.basename(header_file))
            for header_file in header_files
        ]
        data_files.append((install_directory, files_to_install))

        return ret
Exemple #5
0
 def cython_sources(self, sources, extension, silent=True):
     log.info("Compiling Cython extension %s" % extension.name)
     if extension.name == "sipsimple.core._core":
         self.build_dir = os.path.join(self.build_temp, "pjsip")
         if self.clean:
             self.clean_pjsip()
         copy_tree(self.pjsip_dir, self.build_dir, verbose=0)
         try:
             if not os.path.exists(os.path.join(self.build_dir, "build.mak")):
                 self.configure_pjsip(silent=silent)
             self.update_extension(extension, silent=silent)
             self.compile_pjsip()
         except RuntimeError as e:
             log.info("Error building %s: %s" % (extension.name, str(e)))
             return None
     return build_ext.cython_sources(self, sources, extension)
 def cython_sources(self, sources, extension):
     if extension.name == "sipsimple.core._core":
         self.check_cython_version()
         svn_updated = self.fetch_pjsip_from_svn()
         if svn_updated:
             self.patch_pjsip()
             self.patch_portaudio()
         compile_needed = svn_updated
         if not os.path.exists(os.path.join(self.svn_dir, "build.mak")) or self.pjsip_clean_compile:
             self.configure_pjsip()
             compile_needed = True
             self.pjsip_clean_compile = 1
         if self.pjsip_clean_compile:
             self.clean_pjsip()
         self.update_extension(extension)
         if compile_needed or not all(map(lambda x: os.path.exists(x), self.libraries)):
             self.remove_libs()
             self.compile_pjsip()
     return build_ext.cython_sources(self, sources, extension)
 def cython_sources(self, sources, extension):
     if extension.name == "sipsimple.core._core":
         self.check_cython_version()
         svn_updated = self.fetch_pjsip_from_svn()
         if svn_updated:
             self.patch_pjsip()
             self.patch_portaudio()
         compile_needed = svn_updated
         if not os.path.exists(os.path.join(
                 self.svn_dir, "build.mak")) or self.pjsip_clean_compile:
             self.configure_pjsip()
             compile_needed = True
             self.pjsip_clean_compile = 1
         if self.pjsip_clean_compile:
             self.clean_pjsip()
         self.update_extension(extension)
         if compile_needed or not all(
                 map(lambda x: os.path.exists(x), self.libraries)):
             self.remove_libs()
             self.compile_pjsip()
     return build_ext.cython_sources(self, sources, extension)
Exemple #8
0
    def cython_sources(self, sources, extension):
        ret = build_ext.cython_sources(self, sources, extension)

        # should result the module name; e.g, graphics[.pyx]
        module = os.path.basename(sources[0])[:-4]

        # move its headers (foo.h and foo_api.h) to include/pysfml
        destination = os.path.join('include', 'pysfml')

        source = os.path.join('src', 'sfml', module + '.h')
        if os.path.isfile(source):
            try:
                shutil.move(source, destination)
            except shutil.Error:
                pass

        source = os.path.join('src', 'sfml', module + '_api.h')
        if os.path.isfile(source):
            try:
                shutil.move(source, destination)
            except shutil.Error:
                pass

        return ret
Exemple #9
0
	def cython_sources(self, sources, extension):
		ret = build_ext.cython_sources(self, sources, extension)

		# should result the module name; e.g, graphics[.pyx]
		module = os.path.basename(sources[0])[:-4]

		# move its headers (foo.h and foo_api.h) to include/pysfml
		destination = os.path.join('include', 'pysfml')

		source = os.path.join('src', 'sfml', module + '.h')
		if os.path.isfile(source):
			try:
				shutil.move(source, destination)
			except shutil.Error:
				pass

		source = os.path.join('src', 'sfml', module + '_api.h')
		if os.path.isfile(source):
			try:
				shutil.move(source, destination)
			except shutil.Error:
				pass

		return ret