Blender-Exporter failed to compile on yafaray-preset.py

Project:YafaRay
Component:Building scripts
Category:bug report
Priority:normal
Assigned:David Bluecame
Status:active
Description

I am one of YafaRay maintainer for Fedora.

While building Yafaray with Core and Blender-Exporter to allow presets, I encountered a syntax error at that line with python builder

File "/usr/share/blender/scripts/addons/yafaray/ot/yafaray_presets.py", line 341
    class Yafaray_Menu(StructRNA, _GenericUI, metaclass=RNAMeta):  # Yafaray's own Preset Menu drawing: search method for files changed
                                                       ^
SyntaxError: invalid syntax

I include the build.log for reference. Compilation done with the latest git snapshot.

AttachmentSize
build.log on Fedora 773.91 KB

Comments

#1

Assigned to:Anonymous» David Bluecame

Hello,

As fas as I know there is no need to compile the Blender-Exporter python scripts. In fact, if I'm not wrong, the first time Blender is used with YafaRay, it will automatically compile them in the user machine.

If you want to compile the py files for some reason, I think the problem is that the metaclass is not compatible with Python2. If you use for example python -m compileall . it will give you that warning. If you use Python3, as for example python3 -m compileall . then you don't get the error message.

However, in my opinion you don't need to pre-compile the py files, just leave them "as is".

Please let me know if this makes sense to you.

#2

By the way, I want to thank you for maintaining the YafaRay Fedora package. Please let me know if I can help.

Just one comment about your building process. I've seen you use "-O2" for optimization. For your information, we recommend to use "-O3" and "-ffast-math" when building YafaRay code to get best speed. We routinely test YafaRay with those two optimization flags and we try hard to debug any errors caused by them.

#3

Hello David,

IThanks for the clarification. The package succesfully built without using -DBLENDER_ADDON:ON on cmake based on OpenSuse installation guideline instruction. After installing the package without the need to compile python and starting Blender, I encounter a traceback when attempting to enable YafaRay addon via Blender User Preference.

Traceback (most recent call last):
  File "/usr/share/blender/scripts/modules/addon_utils.py", line 330, in enable
    mod = __import__(module_name)
  File "/usr/share/blender/scripts/addons/yafaray/__init__.py", line 66, in <module>
    from . import io
  File "/usr/share/blender/scripts/addons/yafaray/io/__init__.py", line 21, in <module>
    import yafaray_v3_interface
ImportError: No module named 'yafaray_v3_interface'

I noticed yafaray_v3_interface module is missing so I wonder if that is coming from compiling Core file with Blender Addon enabled. Here is the log report failing with enabled blender addon support and the path.

Just one comment about your building process. I've seen you use "-O2" for optimization. For your information, we recommend to use "-O3" and "-ffast-math" when building YafaRay code to get best speed. We routinely test YafaRay with those two optimization flags and we try hard to debug any errors caused by them.

-O2 comes from the default setting in Fedora building system. I will take account of that suggestion.

For the yafary git directory in Fedora: https://src.fedoraproject.org/cgit/rpms/YafaRay.git/tree/

AttachmentSize
build.log 15.46 KB

#4

Component:Blender Exporter» Building scripts

Hello,

Yes, you must build YafaRay Core code with -DBLENDER_ADDON:ON , otherwise Blender Exporter will not work. However, you don't need to compile the python files.

I will try to take a look at the Fedora build script you sent me, but I will need some time. In the mean time please try building Core with the -DBLENDER_ADDON:ON

 

This is the process I follow to build YafaRay in Fedora 24 64bits, It's just a draft for now but I hope it helps:

# FEDORA 24 YafaRay Blender Add-On building procedure (only valid for YafaRay v3.2.0 or higher)
# NOTE: This procedure generates a "yafaray_v3" folder that can be installed in the Blender Add-Ons folder

# INSTALLING LIBRARY DEPENDENCIES
sudo dnf install -y python3-devel zlib-devel libpng-devel freetype-devel libxml2-devel libjpeg-devel libtiff-devel OpenEXR-devel boost-devel swig opencv-devel

# BUILDING AND INSTALLING ADDITIONAL DEPENDENCIES
# This is necessary if using the Blender build downloaded from www.blender.org, as it's using internally libPNG v1.2, otherwise there will be problems when using PNG files
mkdir -p $HOME/yafa-libs/src $HOME/yafa-libs/make $HOME/yafa-libs/build

cd $HOME/yafa-libs/src
wget http://downloads.sourceforge.net/project/libpng/libpng12/1.2.56/libpng-1.2.56.tar.xz
tar -xvxf libpng-1.2.56.tar.xz
mkdir $HOME/yafa-libs/make/libpng-1.2.56
cd $HOME/yafa-libs/make/libpng-1.2.56
$HOME/yafa-libs/src/libpng-1.2.56/configure --enable-shared --prefix=$HOME/yafa-libs/build
make install -j9


# DOWNLOADING YAFARAY AND SETTING UP FOLDERS
mkdir -p $HOME/yafa-dev/src $HOME/yafa-dev/make $HOME/yafa-dev/build
cd $HOME/yafa-dev/src
git clone https://github.com/YafaRay/Blender-Exporter
git clone https://github.com/YafaRay/Core

# CREATE UserConfig.txt FILE WITH YAFARAY BUILDING OPTIONS. Execute the entire block below until (including) EOF
# Using single quotes in 'EOF' to avoid variable substitution when generating the text file

cat <<'EOF' >$HOME/yafa-dev/make/UserConfig.txt
###############################################################################
# UserConfig File to build for Fedora 24
###############################################################################
# WARNING: DON'T TOUCH THE NEXT LINE                                          
set(YAF_USER_CONFIG ON)
###############################################################################

set(DEBUG_BUILD OFF)
set(USER_INSTALL_PREFIX "$ENV{HOME}/yafa-dev/build/yafaray_v3/")
set(YAF_CMAKE_DEPENDENCIES_SEARCH_PATH "$ENV{HOME}/yafa-libs/build")
set(BLENDER_ADDON ON)
set(YAF_PY_VERSION 3.5)
set(BLENDER_EXPORTER_PATH "$ENV{HOME}/yafa-dev/src/Blender-Exporter/")
###############################################################
EOF

# BUILDING YAFARAY
cd $HOME/yafa-dev/make
cmake $HOME/yafa-dev/src/Core
# Note: "-j9" uses 9 threads in this example for speeding up the building process. It can be changed to "-j<number of threads>" depending on the number of cores of the processor used for building YafaRay.
make -j9
make install -j9

#5

Thanks for the drafted instruction. Unfortunately,  have hit a permission issue below:

Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.y3Mtwt
+ umask 022
+ cd /home/luya/Documents/fedora-scm/YafaRay
+ cd /home/luya/Documents/fedora-scm/YafaRay
+ /usr/bin/tar -xof -
+ /usr/bin/gzip -dc /home/luya/Documents/fedora-scm/YafaRay/Core-60452c5.tar.gz
+ STATUS=0
+ '[' 0 -ne 0 ']'
+ cd Core-60452c5586772bcf2eccc47ed5fa9b2930c685b8
+ /usr/bin/chmod -Rf a+rX,u+w,g-w,o-w .
+ cd /home/luya/Documents/fedora-scm/YafaRay
+ cd Core-60452c5586772bcf2eccc47ed5fa9b2930c685b8
+ /usr/bin/gzip -dc /home/luya/Documents/fedora-scm/YafaRay/Blender-Exporter-b521835.tar.gz
+ /usr/bin/tar -xvvof -
drwxrwxr-x root/root         0 2017-02-25 11:56 Blender-Exporter-b521835148d1cd77bcad0f64a989ff47934b9ffc/
-rw-rw-r-- root/root         6 2017-02-25 11:56 Blender-Exporter-b521835148d1cd77bcad0f64a989ff47934b9ffc/.gitignore
-rw-rw-r-- root/root     47534 2017-02-25 11:56 Blender-Exporter-b521835148d1cd77bcad0f64a989ff47934b9ffc/CHANGELOG
-rw-rw-r-- root/root      3681 2017-02-25 11:56 Blender-Exporter-b521835148d1cd77bcad0f64a989ff47934b9ffc/INSTALL
-rw-rw-r-- root/root    142541 2017-02-25 11:56 Blender-Exporter-b521835148d1cd77bcad0f64a989ff47934b9ffc/LICENSES
-rw-rw-r-- root/root      1938 2017-02-25 11:56 Blender-Exporter-b521835148d1cd77bcad0f64a989ff47934b9ffc/README
-rw-rw-r-- root/root      5874 2017-02-25 11:56 Blender-Exporter-b521835148d1cd77bcad0f64a989ff47934b9ffc/__init__.py
drwxrwxr-x root/root         0 2017-02-25 11:56 Blender-Exporter-b521835148d1cd77bcad0f64a989ff47934b9ffc/io/
-rw-rw-r-- root/root      1023 2017-02-25 11:56 Blender-Exporter-b521835148d1cd77bcad0f64a989ff47934b9ffc/io/__init__.py
-rwxrwxr-x root/root     28738 2017-02-25 11:56 Blender-Exporter-b521835148d1cd77bcad0f64a989ff47934b9ffc/io/yaf_export.py
-rw-rw-r-- root/root      7347 2017-02-25 11:56 Blender-Exporter-b521835148d1cd77bcad0f64a989ff47934b9ffc/io/yaf_integrator.py
-rw-rw-r-- root/root     12081 2017-02-25 11:56 Blender-Exporter-b521835148d1cd77bcad0f64a989ff47934b9ffc/io/yaf_light.py
-rw-rw-r-- root/root     29631 2017-02-25 11:56 Blender-Exporter-b521835148d1cd77bcad0f64a989ff47934b9ffc/io/yaf_material.py
-rw-rw-r-- root/root     25437 2017-02-25 11:56 Blender-Exporter-b521835148d1cd77bcad0f64a989ff47934b9ffc/io/yaf_object.py
-rwxrwxr-x root/root     19656 2017-02-25 11:56 Blender-Exporter-b521835148d1cd77bcad0f64a989ff47934b9ffc/io/yaf_scene.py
-rwxrwxr-x root/root     16308 2017-02-25 11:56 Blender-Exporter-b521835148d1cd77bcad0f64a989ff47934b9ffc/io/yaf_texture.py
-rwxrwxr-x root/root      9923 2017-02-25 11:56 Blender-Exporter-b521835148d1cd77bcad0f64a989ff47934b9ffc/io/yaf_world.py
drwxrwxr-x root/root         0 2017-02-25 11:56 Blender-Exporter-b521835148d1cd77bcad0f64a989ff47934b9ffc/ot/
-rw-rw-r-- root/root       909 2017-02-25 11:56 Blender-Exporter-b521835148d1cd77bcad0f64a989ff47934b9ffc/ot/__init__.py
-rw-rw-r-- root/root     16664 2017-02-25 11:56 Blender-Exporter-b521835148d1cd77bcad0f64a989ff47934b9ffc/ot/yafaray_converter.py
-rw-rw-r-- root/root      8053 2017-02-25 11:56 Blender-Exporter-b521835148d1cd77bcad0f64a989ff47934b9ffc/ot/yafaray_operators.py
-rw-rw-r-- root/root     15069 2017-02-25 11:56 Blender-Exporter-b521835148d1cd77bcad0f64a989ff47934b9ffc/ot/yafaray_presets.py
drwxrwxr-x root/root         0 2017-02-25 11:56 Blender-Exporter-b521835148d1cd77bcad0f64a989ff47934b9ffc/presets/
drwxrwxr-x root/root         0 2017-02-25 11:56 Blender-Exporter-b521835148d1cd77bcad0f64a989ff47934b9ffc/presets/render/
-rw-rw-r-- root/root      1500 2017-02-25 11:56 Blender-Exporter-b521835148d1cd77bcad0f64a989ff47934b9ffc/presets/render/MY_Default_Preset.py
drwxrwxr-x root/root         0 2017-02-25 11:56 Blender-Exporter-b521835148d1cd77bcad0f64a989ff47934b9ffc/prop/
-rw-rw-r-- root/root      1406 2017-02-25 11:56 Blender-Exporter-b521835148d1cd77bcad0f64a989ff47934b9ffc/prop/__init__.py
-rw-rw-r-- root/root      3296 2017-02-25 11:56 Blender-Exporter-b521835148d1cd77bcad0f64a989ff47934b9ffc/prop/yaf_camera.py
-rw-rw-r-- root/root      6529 2017-02-25 11:56 Blender-Exporter-b521835148d1cd77bcad0f64a989ff47934b9ffc/prop/yaf_light.py
-rw-rw-r-- root/root     15050 2017-02-25 11:56 Blender-Exporter-b521835148d1cd77bcad0f64a989ff47934b9ffc/prop/yaf_material.py
-rw-rw-r-- root/root      5547 2017-02-25 11:56 Blender-Exporter-b521835148d1cd77bcad0f64a989ff47934b9ffc/prop/yaf_object.py
-rw-rw-r-- root/root     59558 2017-02-25 11:56 Blender-Exporter-b521835148d1cd77bcad0f64a989ff47934b9ffc/prop/yaf_scene.py
-rwxrwxr-x root/root      5467 2017-02-25 11:56 Blender-Exporter-b521835148d1cd77bcad0f64a989ff47934b9ffc/prop/yaf_texture.py
-rw-rw-r-- root/root     12873 2017-02-25 11:56 Blender-Exporter-b521835148d1cd77bcad0f64a989ff47934b9ffc/prop/yaf_world.py
drwxrwxr-x root/root         0 2017-02-25 11:56 Blender-Exporter-b521835148d1cd77bcad0f64a989ff47934b9ffc/tests/
drwxrwxr-x root/root         0 2017-02-25 11:56 Blender-Exporter-b521835148d1cd77bcad0f64a989ff47934b9ffc/tests/test01/
-rw-rw-r-- root/root     89563 2017-02-25 11:56 Blender-Exporter-b521835148d1cd77bcad0f64a989ff47934b9ffc/tests/test01/test01 - expected render result.png
-rw-rw-r-- root/root    596620 2017-02-25 11:56 Blender-Exporter-b521835148d1cd77bcad0f64a989ff47934b9ffc/tests/test01/test01.blend
-rw-rw-r-- root/root     27659 2017-02-25 11:56 Blender-Exporter-b521835148d1cd77bcad0f64a989ff47934b9ffc/tests/test01/test01.xml
-rw-rw-r-- root/root     12023 2017-02-25 11:56 Blender-Exporter-b521835148d1cd77bcad0f64a989ff47934b9ffc/tests/test01/test01_tex.exr
-rw-rw-r-- root/root     31559 2017-02-25 11:56 Blender-Exporter-b521835148d1cd77bcad0f64a989ff47934b9ffc/tests/test01/test01_tex.hdr
-rw-rw-r-- root/root      7389 2017-02-25 11:56 Blender-Exporter-b521835148d1cd77bcad0f64a989ff47934b9ffc/tests/test01/test01_tex.jpg
-rw-rw-r-- root/root      9651 2017-02-25 11:56 Blender-Exporter-b521835148d1cd77bcad0f64a989ff47934b9ffc/tests/test01/test01_tex.png
-rw-rw-r-- root/root    360035 2017-02-25 11:56 Blender-Exporter-b521835148d1cd77bcad0f64a989ff47934b9ffc/tests/test01/test01_tex.tga
-rw-rw-r-- root/root      7176 2017-02-25 11:56 Blender-Exporter-b521835148d1cd77bcad0f64a989ff47934b9ffc/tests/test01/test01_tex.tif
drwxrwxr-x root/root         0 2017-02-25 11:56 Blender-Exporter-b521835148d1cd77bcad0f64a989ff47934b9ffc/ui/
-rw-rw-r-- root/root      8214 2017-02-25 11:56 Blender-Exporter-b521835148d1cd77bcad0f64a989ff47934b9ffc/ui/__init__.py
-rw-rw-r-- root/root      4049 2017-02-25 11:56 Blender-Exporter-b521835148d1cd77bcad0f64a989ff47934b9ffc/ui/ior_values.py
-rw-rw-r-- root/root      3822 2017-02-25 11:56 Blender-Exporter-b521835148d1cd77bcad0f64a989ff47934b9ffc/ui/properties_yaf_AA_settings.py
-rw-rw-r-- root/root      4511 2017-02-25 11:56 Blender-Exporter-b521835148d1cd77bcad0f64a989ff47934b9ffc/ui/properties_yaf_camera.py
-rwxrwxr-x root/root      8493 2017-02-25 11:56 Blender-Exporter-b521835148d1cd77bcad0f64a989ff47934b9ffc/ui/properties_yaf_general_settings.py
-rw-rw-r-- root/root      6919 2017-02-25 11:56 Blender-Exporter-b521835148d1cd77bcad0f64a989ff47934b9ffc/ui/properties_yaf_integrator.py
-rwxrwxr-x root/root     15264 2017-02-25 11:56 Blender-Exporter-b521835148d1cd77bcad0f64a989ff47934b9ffc/ui/properties_yaf_layer_passes.py
-rw-rw-r-- root/root      6202 2017-02-25 11:56 Blender-Exporter-b521835148d1cd77bcad0f64a989ff47934b9ffc/ui/properties_yaf_light.py
-rwxrwxr-x root/root     16167 2017-02-25 11:56 Blender-Exporter-b521835148d1cd77bcad0f64a989ff47934b9ffc/ui/properties_yaf_material.py
-rw-rw-r-- root/root      2977 2017-02-25 11:56 Blender-Exporter-b521835148d1cd77bcad0f64a989ff47934b9ffc/ui/properties_yaf_object.py
-rwxrwxr-x root/root     11327 2017-02-25 11:56 Blender-Exporter-b521835148d1cd77bcad0f64a989ff47934b9ffc/ui/properties_yaf_render.py
-rw-rw-r-- root/root      2232 2017-02-25 11:56 Blender-Exporter-b521835148d1cd77bcad0f64a989ff47934b9ffc/ui/properties_yaf_scene.py
-rw-rw-r-- root/root      2282 2017-02-25 11:56 Blender-Exporter-b521835148d1cd77bcad0f64a989ff47934b9ffc/ui/properties_yaf_strand.py
-rwxrwxr-x root/root     30580 2017-02-25 11:56 Blender-Exporter-b521835148d1cd77bcad0f64a989ff47934b9ffc/ui/properties_yaf_texture.py
-rw-rw-r-- root/root      1872 2017-02-25 11:56 Blender-Exporter-b521835148d1cd77bcad0f64a989ff47934b9ffc/ui/properties_yaf_volume_integrator.py
-rwxrwxr-x root/root     10691 2017-02-25 11:56 Blender-Exporter-b521835148d1cd77bcad0f64a989ff47934b9ffc/ui/properties_yaf_world.py
+ STATUS=0
+ '[' 0 -ne 0 ']'
+ /usr/bin/chmod -Rf a+rX,u+w,g-w,o-w .
+ sed -i -e 's|set(YAF_LIB_DIR lib)|set(YAF_LIB_DIR lib64)|g' CMakeLists.txt
+ sed -i -e 's|set(YAF_TARGET_TYPE ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib RUNTIME)|\
    set(YAF_TARGET_TYPE ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib64 RUNTIME)|g' CMakeLists.txt
+ find . -name '*.h' -exec chmod 644 '{}' ';'
+ find . -name '*.c' -exec chmod 644 '{}' ';'
+ find . -name '*.cc' -exec chmod 644 '{}' ';'
+ exit 0
Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.uybyFl
+ umask 022
+ cd /home/luya/Documents/fedora-scm/YafaRay
+ cd Core-60452c5586772bcf2eccc47ed5fa9b2930c685b8
+ CFLAGS='-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic'
+ export CFLAGS
+ CXXFLAGS='-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic'
+ export CXXFLAGS
+ FFLAGS='-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic -I/usr/lib64/gfortran/modules'
+ export FFLAGS
+ FCFLAGS='-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic -I/usr/lib64/gfortran/modules'
+ export FCFLAGS
+ LDFLAGS='-Wl,-z,relro -specs=/usr/lib/rpm/redhat/redhat-hardened-ld'
+ export LDFLAGS
+ /usr/bin/cmake -DCMAKE_C_FLAGS_RELEASE:STRING=-DNDEBUG -DCMAKE_CXX_FLAGS_RELEASE:STRING=-DNDEBUG -DCMAKE_Fortran_FLAGS_RELEASE:STRING=-DNDEBUG -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -DCMAKE_INSTALL_PREFIX:PATH=/usr -DINCLUDE_INSTALL_DIR:PATH=/usr/include -DLIB_INSTALL_DIR:PATH=/usr/lib64 -DSYSCONF_INSTALL_DIR:PATH=/etc -DSHARE_INSTALL_PREFIX:PATH=/usr/share -DLIB_SUFFIX=64 -DBUILD_SHARED_LIBS:BOOL=ON -DBLENDER_ADDON=ON -DBLENDER_EXPORTER_PATH=/home/luya/Documents/fedora-scm/YafaRay/Core-60452c5586772bcf2eccc47ed5fa9b2930c685b8/Blender-Exporter-b521835148d1cd77bcad0f64a989ff47934b9ffc -DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=true -DCMAKE_SKIP_RPATH:BOOL=true -DDEBUG_BUILD=ON -DWITH_QT=OFF '-DUSER_DBGFLAGS=-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic -O3 -ffast-math' .
-- Boost version: 1.60.0
-- Found the following Boost libraries:
--   system
--   filesystem
--   serialization
--   locale
Using OpenCV: yes
Using LibXML: yes
Using FreeType: yes
-- Found OpenEXR: /usr/lib64/libIlmImf.so
Using OpenEXR: yes
Using JPEG: yes
Using PNG: yes
Using TIFF: yes
Using Qt: no
Building XML loader: yes
Building Python bindings: yes
Building Ruby bindings: no
** Blender-Exporter Add-On building enabled.
CMake Error: Could not open file for write in copy operation /usr/__init__.py.tmp
CMake Error: : System Error: Permission denied
CMake Error at CMakeConfig/CPackConfig.txt:43 (configure_file):
  configure_file Problem configuring file
Call Stack (most recent call first):
  CMakeLists.txt:201 (include)


Using SWIG executables: /usr/bin/swig
Searching for Python 3.5
Python 3.5 found at: /usr/lib64/libpython3.5m.so
Python header path: /usr/include/python3.5m
-- Configuring incomplete, errors occurred!
See also "/home/luya/Documents/fedora-scm/YafaRay/Core-60452c5586772bcf2eccc47ed5fa9b2930c685b8/CMakeFiles/CMakeOutput.log".
error: Bad exit status from /var/tmp/rpm-tmp.uybyFl (%build)

If you can fix the permission issue on Blender-Exporter, then the build will work.

#6

Hello,

Please I would like to replicate your Fedora package building environment to do these tests myself. How can I setup such a system?

#7

Certainly. Assuming you already have Fedora 24 and up installed, please follow this guideline.

Some useful command are rpmdev-setuptree to get build directories in $HOME. Tarballs and patches are inside $HOME/rpmbuild/SOURCES, spec files are inside $HOME/rpmbuild/SPECS. SRPMS are for sources files in rpm format and RPMS are the binary rpm.

You can use the spec file provide on comment #3 adapted from the instruction below.